
import earcut from 'earcut';
import { BoxGeometry, BufferAttribute, BufferGeometry, CylinderGeometry, DoubleSide, ExtrudeGeometry, Float32BufferAttribute, LineCurve3, Matrix4, MeshLambertMaterial, Object3D, Path, Shape, ShapeGeometry, Vector2, Vector3 } from "three";
import { EntityCreateType, AK } from '../const/ModelConst';
import AModelFmulaUtils from './AModelFmulaUtils';
import MeshGeomLib from './MeshGeomLib';
import MoldUtils from './MoldUtils';
import { BIM } from './BIM';


export class GeometryControlUtils {
    private static _GeometryControlUtils: GeometryControlUtils;
    public static get single(): GeometryControlUtils {
        if (this._GeometryControlUtils == null) {
            this._GeometryControlUtils = new GeometryControlUtils();
        }
        return this._GeometryControlUtils;
    }

    /**
     * 挤压几何体应用生成
     * vecs 可以是一组点,也可以是长宽 type 1是点2是长宽  默认是1
     * ishole是否要扣洞
     */
    public extrudeBufferGeometry(vecs: any[], depth: number = 0, ishole: boolean = false, type: number = 1): BufferGeometry {
        let i: number, j: number;
        let arr = [];
        if (type === 1) {
            for (i = 0; i < vecs.length; i++) {
                arr.push(new Vector2(vecs[i].x, vecs[i].y));
            }
        } else {
            arr.push(new Vector2(-vecs[0] / 2, -vecs[1] / 2));
            arr.push(new Vector2(-vecs[0] / 2, vecs[1] / 2));
            arr.push(new Vector2(vecs[0] / 2, vecs[1] / 2));
            arr.push(new Vector2(vecs[0] / 2, -vecs[1] / 2));
        }
        var squareShape = new Shape(arr);
        if (ishole) {
            var squareShapePath = new Path();
            // squareShapePath.moveTo( 10, 10 );
            // squareShapePath.lineTo( 10, height -10); 
            // squareShapePath.lineTo( wdth - 10, height - 10);
            // squareShapePath.lineTo( wdth -10 , 10 );
            // squareShapePath.lineTo( 10, 10 );
            squareShape.holes.push(squareShapePath);// 挖洞

        }
        var extrudeSettings = { depth: depth, bevelEnabled: false, bevelSegments: 1, bevelThickness: 0.2 };
        var geometry = new ExtrudeGeometry(squareShape, extrudeSettings);
        // ExtrudeBufferGeometry转换BufferGeometry
        var bGeometry = new BufferGeometry();
        // bGeometry.attributes.normal = geometry.attributes.normal;
        bGeometry.attributes.position = geometry.attributes.position;
        bGeometry.attributes.uv = geometry.attributes.uv;
        return bGeometry;
    }

    /**
     * 形状平面几何体应用生成
     * vecs 可以是一组点,也可以是长宽 type 1是点2是长宽  默认是1
     */
    private shapeBufferGeometry(vecs: any[], type: number = 1): ShapeGeometry {
        let i: number, j: number;
        let arr = [];
        if (type === 1) {
            for (i = 0; i < vecs.length; i++) {
                arr.push(new Vector2(vecs[i].x, vecs[i].y));
            }
        } else {
            arr.push(new Vector2(-vecs[0] / 2, -vecs[1] / 2));
            arr.push(new Vector2(-vecs[0] / 2, vecs[1] / 2));
            arr.push(new Vector2(vecs[0] / 2, vecs[1] / 2));
            arr.push(new Vector2(vecs[0] / 2, -vecs[1] / 2));
        }
        var squareShape = new Shape(arr);
        var geometry = new ShapeGeometry(squareShape);
        return geometry;
    }


    /**
     * 合并几何体
     */
    public mergeBufferGeometry(meshs: any[]): BufferGeometry {
        const sumPosArr = new Array();
        const sumNormArr = new Array();
        const sumUvArr = new Array();
        const modelGeometry = new BufferGeometry();
        let sumPosCursor = 0;
        let sumNormCursor = 0;
        let sumUvCursor = 0;
        let startGroupCount = 0;
        let lastGroupCount = 0;
        for (let a = 0; a < meshs.length; a++) {
            let tempgeom = (meshs[a].geometry as BufferGeometry);
            const posAttArr = (tempgeom.getAttribute('position') as Float32BufferAttribute).array;
            for (let b = 0; b < posAttArr.length; b++) {
                sumPosArr[b + sumPosCursor] = posAttArr[b];
            }
            sumPosCursor += posAttArr.length;
            if (!tempgeom.getAttribute('normal')) {
                tempgeom.computeVertexNormals();//面片法向量的平均值计算每个顶点的法向量。
            }
            const numAttArr = (tempgeom.getAttribute('normal') as Float32BufferAttribute).array;
            for (let b = 0; b < numAttArr.length; b++) {
                sumNormArr[b + sumNormCursor] = numAttArr[b];
            }
            sumNormCursor += numAttArr.length;
            const uvAttArr = (tempgeom.getAttribute('uv') as Float32BufferAttribute).array;
            for (let b = 0; b < uvAttArr.length; b++) {
                sumUvArr[b + sumUvCursor] = uvAttArr[b];
            }
            sumUvCursor += uvAttArr.length;
            const groupArr = tempgeom.groups;
            for (let b = 0; b < groupArr.length; b++) {
                startGroupCount = lastGroupCount
                modelGeometry.addGroup(startGroupCount, groupArr[b].count, groupArr[b].materialIndex)
                lastGroupCount = startGroupCount + groupArr[b].count
            }
        }
        modelGeometry.setAttribute('position', new Float32BufferAttribute(sumPosArr, 3));
        sumNormArr.length && modelGeometry.setAttribute('normal', new Float32BufferAttribute(sumNormArr, 3));
        sumUvArr.length && modelGeometry.setAttribute('uv', new Float32BufferAttribute(sumUvArr, 2));

        return modelGeometry;
    }


    public mergeBufferGeometries(geometries: BufferGeometry[], useGroups: boolean = false) {

        const isIndexed = geometries[0].index !== null;

        const attributesUsed = new Set(Object.keys(geometries[0].attributes));
        const morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes));

        const attributes = {};
        const morphAttributes = {};

        const morphTargetsRelative = geometries[0].morphTargetsRelative;

        const mergedGeometry = new BufferGeometry();

        let offset = 0;

        for (let i = 0; i < geometries.length; ++i) {

            const geometry = geometries[i];
            let attributesCount = 0;

            // ensure that all geometries are indexed, or none

            if (isIndexed !== (geometry.index !== null)) {

                console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.');
                return null;

            }

            // gather attributes, exit early if they're different

            for (const name in geometry.attributes) {

                if (!attributesUsed.has(name)) {

                    console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure "' + name + '" attribute exists among all geometries, or in none of them.');
                    return null;

                }

                if (attributes[name] === undefined) attributes[name] = [];

                attributes[name].push(geometry.attributes[name]);

                attributesCount++;

            }

            // ensure geometries have the same number of attributes

            if (attributesCount !== attributesUsed.size) {

                console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.');
                return null;

            }

            // gather morph attributes, exit early if they're different

            if (morphTargetsRelative !== geometry.morphTargetsRelative) {

                console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.');
                return null;

            }

            for (const name in geometry.morphAttributes) {

                if (!morphAttributesUsed.has(name)) {

                    console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '.  .morphAttributes must be consistent throughout all geometries.');
                    return null;

                }

                if (morphAttributes[name] === undefined) morphAttributes[name] = [];

                morphAttributes[name].push(geometry.morphAttributes[name]);

            }

            // gather .userData

            mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];
            mergedGeometry.userData.mergedUserData.push(geometry.userData);

            if (useGroups) {

                let count;

                if (isIndexed) {

                    count = geometry.index.count;

                } else if (geometry.attributes.position !== undefined) {

                    count = geometry.attributes.position.count;

                } else {

                    console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute');
                    return null;

                }

                mergedGeometry.addGroup(offset, count, i);

                offset += count;

            }

        }

        // merge indices

        if (isIndexed) {

            let indexOffset = 0;
            const mergedIndex = [];

            for (let i = 0; i < geometries.length; ++i) {

                const index = geometries[i].index;

                for (let j = 0; j < index.count; ++j) {

                    mergedIndex.push(index.getX(j) + indexOffset);

                }

                indexOffset += geometries[i].attributes.position.count;

            }

            mergedGeometry.setIndex(mergedIndex);

        }

        // merge attributes

        for (const name in attributes) {

            const mergedAttribute = GeometryControlUtils.single.mergeBufferAttributes(attributes[name]);

            if (!mergedAttribute) {

                console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' attribute.');
                return null;

            }

            mergedGeometry.setAttribute(name, mergedAttribute);

        }

        // merge morph attributes

        for (const name in morphAttributes) {

            const numMorphTargets = morphAttributes[name][0].length;

            if (numMorphTargets === 0) break;

            mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};
            mergedGeometry.morphAttributes[name] = [];

            for (let i = 0; i < numMorphTargets; ++i) {

                const morphAttributesToMerge = [];

                for (let j = 0; j < morphAttributes[name].length; ++j) {

                    morphAttributesToMerge.push(morphAttributes[name][j][i]);

                }

                const mergedMorphAttribute = GeometryControlUtils.single.mergeBufferAttributes(morphAttributesToMerge);

                if (!mergedMorphAttribute) {

                    console.warn('THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' morphAttribute.');
                    return null;

                }

                mergedGeometry.morphAttributes[name].push(mergedMorphAttribute);

            }

        }

        return mergedGeometry;

    }



    public mergeBufferAttributes(attributes: BufferAttribute[]) {

        let TypedArray;
        let itemSize;
        let normalized;
        let arrayLength = 0;

        for (let i = 0; i < attributes.length; ++i) {

            const attribute = attributes[i];

            // if ( attribute.isInterleavedBufferAttribute ) {

            //     console.warn( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.' );
            //     return null;

            // }

            if (TypedArray === undefined) TypedArray = attribute.array.constructor;
            if (TypedArray !== attribute.array.constructor) {

                console.warn('THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.');
                return null;

            }

            if (itemSize === undefined) itemSize = attribute.itemSize;
            if (itemSize !== attribute.itemSize) {

                console.warn('THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.');
                return null;

            }

            if (normalized === undefined) normalized = attribute.normalized;
            if (normalized !== attribute.normalized) {

                console.warn('THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.');
                return null;

            }

            arrayLength += attribute.array.length;

        }

        const array = new TypedArray(arrayLength);
        let offset = 0;

        for (let i = 0; i < attributes.length; ++i) {

            array.set(attributes[i].array, offset);

            offset += attributes[i].array.length;

        }

        return new BufferAttribute(array, itemSize, normalized);

    }

    // public getmoldGeom(m: BIMAIMesh): BufferGeometry {
    //     let v: any, buff: BufferGeometry, c: any;
    //     if (m.meshType > EntityCreateType.AngleAluminumShrouding && m.meshType <= EntityCreateType.StairStepMask) {
    //         v = m.translateVec;
    //         buff = MeshControlUtils.single.getAluGeometry(m.userData, m.meshType);
    //         buff.computeBoundingBox();
    //         buff.boundingBox.getCenter(m.translateVec);
    //         buff.center();
    //         if (m.iscenter) {
    //             if (m.meshType > EntityCreateType.modeStart && !(m.meshType == EntityCreateType.StairStepCover ||
    //                 m.meshType == EntityCreateType.StairStepMask)) {
    //                 buff.translate(m.translateVec.x, m.translateVec.y, m.translateVec.z);
    //             } else {
    //                 buff.translate(0, m.translateVec.y, 0);
    //             }
    //         }
    //     }
    //     else {
    //         c = BIM.SC.mold.updateALMold(m.meshType, m.userData);
    //         buff = c.geometry;
    //         buff.translate(c.translateVec.x, c.translateVec.y, c.translateVec.z);
    //     }

    //     return buff;
    // }

    /**
     * 楼梯模板 侧板
     */
    public getStairSideBoard(o: any): any[] {
        let i: number, j: number, boo: boolean = false;
        let vec = [];
        let vec2: Vector2[] = [];
        let L: number = Number(o.L), W: number = Number(o.W), GMT: number = o.GMT;
        let BKH: number = o.BKH, bkT: number = o.bkT, BKDia: number = o.BKDia;
        let BKKJMDis: number = o.BKKJMDis, SLW: number = Number(o.SLW), SLH: number = Number(o.SLH);
        let p_ddcd: number = Number(o[AK.p_ddcd]), p_ddwz: number = Number(o[AK.p_ddwz]);
        let faceArr: any = [];
        let vertices: number[] = [];
        let vertices3: number[] = [];
        let pppps = [];
        let holes = [], expressarr = [];
        let tempObj;

        let indics = [];
        let holeIndex = null;
        holeIndex = [];
        let curr = vertices3.length / 3;
        let len = 0;
        holes = [];
        //下
        if (!o[AK.p_xksctype]) {
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_xkkw], W, 2, o, AK.p_xkkw);
            expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value }) });
            pppps = [new Vector3(0, 0, 0), new Vector3(0, 0, BKH), new Vector3(W, 0, BKH), new Vector3(W, 0, 0)];
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 1, bkT);
            tempObj.indics.reverse();
            indics.push(...tempObj.indics);
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
        }

        //上
        if (!o[AK.p_sksctype]) {
            holes = [];
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_skkw], W, 2, o, AK.p_skkw);
            expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value }) });
            pppps = [new Vector3(0, (L - bkT), 0), new Vector3(0, (L - bkT), BKH), new Vector3(W, (L - bkT), BKH), new Vector3(W, (L - bkT), 0)];
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 1, bkT);
            tempObj.indics.reverse();
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
        }


        //左
        if (!o[AK.p_zksctype]) {
            holes = [];
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zkkw], L, 2, o, AK.p_zkkw);
            expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value }) });
            pppps = [new Vector3(0, 0, 0), new Vector3(0, 0, BKH), new Vector3(0, L, BKH), new Vector3(0, L, 0)];
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
        }

        //右
        if (!o[AK.p_yksctype]) {
            holes = [];
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_ykkw], L, 2, o, AK.p_ykkw);
            expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value }) });
            pppps = [new Vector3((W - bkT), 0, 0), new Vector3((W - bkT), 0, BKH), new Vector3((W - bkT), L, BKH), new Vector3((W - bkT), L, 0)];
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
        }


        // vertices = [];
        // for (i = 0; i < tempObj.vec.length; i += 3) {
        //     vertices.push(tempObj.vec[i]+(W-bkT),tempObj.vec[i+1],tempObj.vec[i+2]);
        // }
        // indics.push(...tempObj.indics.map((value) => {value += vec.length/3;return value;}));
        // vec.push(...vertices);
        //光面
        holes = [];
        if (o[AK.p_r1dw] && o[AK.p_r1dw] != '' && o[AK.p_r1dw].indexOf('(') > -1 && o[AK.p_r1dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r1], o[AK.p_r1dw], holes);
        }
        if (o[AK.p_r2dw] && o[AK.p_r2dw] != '' && o[AK.p_r2dw].indexOf('(') > -1 && o[AK.p_r2dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r2], o[AK.p_r2dw], holes);
        }
        if (o[AK.p_r3dw] && o[AK.p_r3dw] != '' && o[AK.p_r3dw].indexOf('(') > -1 && o[AK.p_r3dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r3], o[AK.p_r3dw], holes);
        }
        vertices = [];
        pppps = [new Vector3(0, 0, 0), new Vector3(W, 0, 0), new Vector3(W, L, 0), new Vector3(0, L, 0)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, GMT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //打断竖肋
        if (o[AK.p_iscj]) {
            if (o[AK.p_sldw] && o[AK.p_sldw].length > 0) {
                expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_sldw], W, 2, o, AK.p_sldw);
                for (i = 0; i < expressarr.length; i++) {
                    if (p_ddcd > 0) {
                        if (!p_ddwz) {
                            pppps = [new Vector3(expressarr[i], bkT + p_ddcd, GMT), new Vector3(expressarr[i] + SLW, bkT + p_ddcd, GMT),
                            new Vector3(expressarr[i] + SLW, L - bkT, GMT), new Vector3(expressarr[i], L - bkT, GMT)];
                            tempObj = MeshGeomLib.getFaceHoleNs(pppps, [], 2, SLH);
                            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                            vec.push(...tempObj.vec);

                            faceArr.push(pppps.concat());
                        } else {
                            pppps = [new Vector3(expressarr[i], bkT, GMT), new Vector3(expressarr[i] + SLW, bkT, GMT),
                            new Vector3(expressarr[i] + SLW, bkT + p_ddwz, GMT), new Vector3(expressarr[i], bkT + p_ddwz, GMT)];
                            tempObj = MeshGeomLib.getFaceHoleNs(pppps, [], 2, SLH);
                            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                            vec.push(...tempObj.vec);

                            faceArr.push(pppps.concat());

                            pppps = [new Vector3(expressarr[i], bkT + p_ddwz + p_ddcd, GMT), new Vector3(expressarr[i] + SLW, bkT + p_ddwz + p_ddcd, GMT),
                            new Vector3(expressarr[i] + SLW, L - bkT, GMT), new Vector3(expressarr[i], L - bkT, GMT)];
                            tempObj = MeshGeomLib.getFaceHoleNs(pppps, [], 2, SLH);
                            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                            vec.push(...tempObj.vec);

                            faceArr.push(pppps.concat());
                        }
                    } else {
                        pppps = [new Vector3(expressarr[i], bkT, GMT), new Vector3(expressarr[i] + SLW, bkT, GMT),
                        new Vector3(expressarr[i] + SLW, L - bkT, GMT), new Vector3(expressarr[i], L - bkT, GMT)];

                        tempObj = MeshGeomLib.getFaceHoleNs(pppps, [], 2, SLH);
                        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                        vec.push(...tempObj.vec);

                        faceArr.push(pppps.concat());
                    }

                }
            }
        }

        o.zhong = {
            L: [
                {
                    pointer: [W / 2, L, 0],
                    center: [W / 2, L / 2, 0]
                }
            ],
            W: [
                {
                    pointer: [W, L / 2, 0],
                    center: [W / 2, L / 2, 0]
                }
            ],
            RL: [
                {
                    pointer: [W / 2, 0, 0],
                    center: [W / 2, L / 2, 0]
                }
            ],
            RW: [
                {
                    pointer: [0, L / 2, 0],
                    center: [W / 2, L / 2, 0]
                }
            ]
        }

        o.duan = [
            0, 0, 0,
            W, 0, 0,
            W, L, 0,
            0, L, 0,
        ]

        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr };
        return [vec,indics,faceArr];
    }
    /**
     * 楼梯模板 挡板
     */
    public getStairGuardBoard(o: any): any[] {
        let i: number, j: number, boo: boolean = false;
        let vec = [];
        let vec2: Vector2[] = [];
        let L: number = Number(o.L), W: number = Number(o.W), GMT: number = o.GMT;
        let BKH: number = o.BKH, bkT: number = o.bkT, BKDia: number = o.BKDia;
        let BKKJMDis: number = o.BKKJMDis, HLW: number = Number(o.HLW), HLH: number = Number(o.HLH);
        let p_ddcd: number = Number(o[AK.p_ddcd]), p_ddwz: number = Number(o[AK.p_ddwz]);
        let faceArr: any = [];
        let vertices: number[] = [];
        let vertices3: number[] = [];
        let pppps = [];
        let holes = [], expressarr = [];
        let tempObj;

        let indics = [];
        let holeIndex = null;
        holeIndex = [];
        let curr = vertices3.length / 3, bottonBkT = 4;
        let len = 0;
        holes = [];
        //下
        // expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_xkkw],W,2,o,AK.p_xkkw);
        // expressarr.map((value) => {holes.push({radius:BKDia/2,x:BKH/2,y:value})});
        pppps = [new Vector3(0, 0, 10), new Vector3(0, 0, BKH), new Vector3(L, 0, BKH), new Vector3(L, 0, 10)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 1, bottonBkT);
        tempObj.indics.reverse();
        indics.push(...tempObj.indics);
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //上p
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zkkw], L, 2, o, AK.p_zkkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKKJMDis, y: value }) });
        pppps = [new Vector3(0, (W - bkT), 0), new Vector3(0, (W - bkT), BKH), new Vector3(L, (W - bkT), BKH), new Vector3(L, (W - bkT), 0)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 1, bkT);
        tempObj.indics.reverse();
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());


        //左
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_skkw], W, 2, o, AK.p_skkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKKJMDis, y: value }) });
        pppps = [new Vector3(0, bottonBkT, 0), new Vector3(0, bottonBkT, BKH), new Vector3(0, W, BKH), new Vector3(0, W, 0)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //右
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_xkkw], W, 2, o, AK.p_xkkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKKJMDis, y: value }) });
        pppps = [new Vector3((L - bkT), bottonBkT, 0), new Vector3((L - bkT), bottonBkT, BKH), new Vector3((L - bkT), W, BKH), new Vector3((L - bkT), W, 0)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //光面
        holes = [];
        vertices = [];
        pppps = [new Vector3(0, 0, BKH - GMT), new Vector3(L, 0, BKH - GMT), new Vector3(L, W, BKH - GMT), new Vector3(0, W, BKH - GMT)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, GMT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        if (o[AK.p_hldw] && o[AK.p_hldw].length > 0) {
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_hldw], L, 2, o, AK.p_hldw);
            for (i = 0; i < expressarr.length; i++) {
                pppps = [new Vector3(expressarr[i], bottonBkT, BKH - HLH), new Vector3(expressarr[i] + HLW, bottonBkT, BKH - HLH),
                new Vector3(expressarr[i] + HLW, W - bottonBkT, BKH - HLH), new Vector3(expressarr[i], W - bottonBkT, BKH - HLH)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 2, HLH);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());
            }
        }
        o.duan = [
            -L / 2, 0, BKH / 2,
            L / 2, 0, BKH / 2,
            L / 2, W, BKH / 2,
            -L / 2, W, BKH / 2,
        ]
        o.zhong = {
            L: [
                {
                    pointer: [L / 2, W / 2, BKH / 2],
                    center: [0, W / 2, BKH / 2]

                }
            ],
            W: [
                {
                    pointer: [0, W, BKH / 2],
                    center: [0, W / 2, BKH / 2]
                }
            ],
            RL: [
                {
                    pointer: [-L / 2, W / 2, BKH / 2],
                    center: [0, W / 2, BKH / 2]

                }
            ],
            RW: [
                {
                    pointer: [0, 0, BKH / 2],
                    center: [0, W / 2, BKH / 2]
                }
            ]
        }
        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr };
        return [vec,indics,faceArr];
    }
    /**
     * 楼梯模板 盖板
     */
    public getStairCoverBoard(o: any): any[] {
        let i: number, j: number, k: number = 0, boo: boolean = false;
        let vec = [];
        let vec2: Vector2[] = [];
        let L: number = Number(o.L), W: number = Number(o.W), GMT: number = o.GMT, EP: number = Number(o[AK.EP]);
        let BKH: number = o.BKH, bkT: number = o.bkT, BKDia: number = o.BKDia, SP: number = Number(o[AK.SP]);
        let BKKJMDis: number = Number(o.BKKJMDis), HLW: number = Number(o.HLW), HLH: number = Number(o.HLH);
        let sjdpW: number = o.sjdpW, sjdpH: number = o.sjdpH, SLW: number = Number(o.SLW), SLH: number = Number(o.SLH);
        let DJXQW: number = Number(o[AK.DJXQW]), DJXQH: number = Number(o[AK.DJXQH]), gckL: number = Number(o[AK.gckL]);
        let gckW: number = Number(o[AK.gckW]), zybkL: number = Number(o[AK.zybkL]), p_qkw: number = Number(o[AK.p_qkw]);
        let qkkpos: number = 51;
        let vertices: number[] = [];
        let vertices3: number[] = [];
        let pppps = [];
        let holes = [], expressarr = [], expressarr2 = [], expressarr3 = [], expressarr4 = [];
        let tempObj;
        let faceArr: any = [];
        let indics = [];
        let holeIndex = null;
        holeIndex = [];
        let curr = vertices3.length / 3;
        let len = 0;
        //左
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zkkw], zybkL, 2, o, AK.p_zkkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, y: BKH - BKKJMDis, x: value + p_qkw }) });
        pppps = [new Vector3(0, 0, p_qkw), new Vector3(0, o[AK.BKH], p_qkw), new Vector3(0, o[AK.BKH], zybkL + p_qkw), new Vector3(0, 0, zybkL + p_qkw)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());
        //右
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_ykkw], zybkL, 2, o, AK.p_ykkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, y: BKH - BKKJMDis, x: value + p_qkw }) });
        pppps = [new Vector3((L - bkT), 0, p_qkw), new Vector3((L - bkT), o[AK.BKH], p_qkw), new Vector3((L - bkT), o[AK.BKH], zybkL + p_qkw), new Vector3((L - bkT), 0, zybkL + p_qkw)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());


        if (o[AK.p_iscreat]) {
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_gckdw], L, 2, o, AK.p_gckdw, 10001);
            expressarr3 = expressarr.concat();
            for (i = 0; i < expressarr.length; i++) {
                holes = [];
                expressarr2 = AModelFmulaUtils.getHolesbyExpress(o['C' + AK.gckkbk], gckW, 2, o, 'C' + AK.gckkbk);
                expressarr2.map((value) => { holes.push({ radius: BKDia / 2, y: BKH - BKKJMDis, x: W + p_qkw - gckW + value }) });
                pppps = [new Vector3(expressarr[i]-gckL/2, GMT, W + p_qkw - gckW), new Vector3(expressarr[i]-gckL/2, GMT + BKH, W + p_qkw - gckW), new Vector3(expressarr[i]-gckL/2, GMT + BKH, W + p_qkw), new Vector3(expressarr[i]-gckL/2, GMT, W + p_qkw)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());

                pppps = [new Vector3(expressarr[i]-gckL/2 + bkT + 0.1, GMT, W - gckW + p_qkw), new Vector3(expressarr[i]-gckL/2 + bkT + 0.1, GMT + BKH, W - gckW + p_qkw), new Vector3(expressarr[i]-gckL/2 + bkT + 0.1, GMT + BKH, W + p_qkw), new Vector3(expressarr[i]-gckL/2 + bkT + 0.1, GMT, W + p_qkw)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());

                //右
                pppps = [new Vector3(expressarr[i] + gckL/2 + bkT, GMT, W - gckW + p_qkw), new Vector3(expressarr[i] + gckL/2 + bkT, GMT + BKH, W - gckW + p_qkw), new Vector3(expressarr[i] + gckL/2 + bkT, GMT + BKH, W + p_qkw), new Vector3(expressarr[i] + gckL/2 + bkT, GMT, W + p_qkw)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());

                pppps = [new Vector3(expressarr[i] + gckL/2 - 0.1, GMT, W - gckW + p_qkw), new Vector3(expressarr[i] + gckL/2 - 0.1, GMT + BKH, W - gckW + p_qkw), new Vector3(expressarr[i] + gckL/2 - 0.1, GMT + BKH, W + p_qkw), new Vector3(expressarr[i] + gckL/2 - 0.1, GMT, W + p_qkw)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());

                holes = [];
                expressarr2 = AModelFmulaUtils.getHolesbyExpress(o['C' + AK.gckcbk], gckL, 2, o, 'C' + AK.gckcbk);
                // expressarr4 = expressarr4.concat(expressarr2);
                expressarr2.map((value) => {
                    expressarr4.push(value + bkT + expressarr[i] - gckL/2);
                    holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: expressarr[i]-gckL/2 + bkT + value });
                });
                pppps = [new Vector3(expressarr[i]-gckL/2, GMT, W - gckW + p_qkw - bkT), new Vector3(expressarr[i]-gckL/2, GMT + BKH, W - gckW + p_qkw - bkT), new Vector3(expressarr[i] + gckL/2 + 2 * bkT, GMT + BKH, W - gckW + p_qkw - bkT), new Vector3(expressarr[i] + gckL/2 + 2 * bkT, GMT, W - gckW + p_qkw - bkT)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 2, bkT);
                tempObj.indics.reverse();
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());

                holes = [];
                expressarr2.map((value) => { holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: expressarr[i]-gckL/2 + value }) });
                pppps = [new Vector3(expressarr[i]-gckL/2 + bkT, GMT, W - gckW + 0.1 + p_qkw), new Vector3(expressarr[i] + gckL/2, GMT, W - gckW + 0.1 + p_qkw), new Vector3(expressarr[i] + gckL/2, GMT + BKH, W - gckW + 0.1 + p_qkw), new Vector3(expressarr[i]-gckL/2 + bkT, GMT + BKH, W - gckW + 0.1 + p_qkw)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 2, bkT);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());
            }
        }


        //光面
        holes = [];
        vertices = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_xkkw], L, 2, o, AK.p_xkkw);
        let str: string = '';
        //过滤观察口内的孔
        for (i = 0; i < expressarr.length; i++) {
            boo = false;
            for (j = 0; j < expressarr3.length; j++) {
                if (!((expressarr[i] - BKDia / 2 > expressarr3[j] + gckL/2) ||
                    (expressarr[i] + BKDia / 2 < expressarr3[j] - gckL/2))) {
                    boo = true;
                }
            }

            if (!boo) {
                if (k === 0) {
                    str += '(' + (expressarr[i]) + ',' + (W + p_qkw - BKKJMDis) + ')';
                } else {
                    str += ',(' + (expressarr[i]) + ',' + (W + p_qkw - BKKJMDis) + ')';
                }
                k++;
            }
        }
        for (i = 0; i < expressarr4.length; i++) {
            if (k === 0) {
                str += '(' + expressarr4[i] + ',' + (W + p_qkw - BKKJMDis) + ')';
            } else {
                str += ',(' + expressarr4[i] + ',' + (W + p_qkw - BKKJMDis) + ')';
            }
            k++;
        }
        MoldUtils.getGmtHoles(BKDia.toString(), str, holes);
        if (o[AK.p_r1dw] && o[AK.p_r1dw] != '' && o[AK.p_r1dw].indexOf('(') > -1 && o[AK.p_r1dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r1].toString(), o[AK.p_r1dw], holes, 1);
        }
        if (o[AK.p_r2dw] && o[AK.p_r2dw] != '' && o[AK.p_r2dw].indexOf('(') > -1 && o[AK.p_r2dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r2].toString(), o[AK.p_r2dw], holes, 1);
        }
        if (o[AK.p_r3dw] && o[AK.p_r3dw] != '' && o[AK.p_r3dw].indexOf('(') > -1 && o[AK.p_r3dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r3].toString(), o[AK.p_r3dw], holes, 1);
        }
        pppps = [new Vector3(0, 0, 0), new Vector3(L, 0, 0), new Vector3(L, 0, W + p_qkw), new Vector3(0, 0, W + p_qkw)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, GMT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        pppps = [new Vector3(bkT, GMT, p_qkw + qkkpos), new Vector3(bkT + sjdpW, GMT, p_qkw + qkkpos), new Vector3(bkT + sjdpW, GMT + sjdpH, p_qkw + qkkpos), new Vector3(bkT, GMT + sjdpH, p_qkw + qkkpos)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        pppps = [new Vector3(L - bkT, GMT, p_qkw + qkkpos), new Vector3(L - bkT - sjdpW, GMT, p_qkw + qkkpos), new Vector3(L - bkT - sjdpW, GMT + sjdpH, p_qkw + qkkpos), new Vector3(L - bkT, GMT + sjdpH, p_qkw + qkkpos)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        if (o[AK.p_hldw] && o[AK.p_hldw].length > 0) {
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_hldw], L, 2, o, AK.p_hldw);
            for (i = 0; i < expressarr.length; i++) {
                pppps = [new Vector3(expressarr[i] - HLW / 2, GMT, SP + p_qkw), new Vector3(expressarr[i] + HLW / 2, GMT, SP + p_qkw),
                new Vector3(expressarr[i] + HLW / 2, GMT, W - EP), new Vector3(expressarr[i] - HLW / 2, GMT, W - EP)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 1, HLH);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());
            }
        }

        if (o[AK.p_sldw] && o[AK.p_sldw].length > 0) {
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_sldw], W, 2, o, AK.p_sldw);
            for (i = 0; i < expressarr.length; i++) {
                pppps = [new Vector3(bkT, GMT, p_qkw + expressarr[i] - SLW / 2), new Vector3(bkT, GMT, p_qkw + expressarr[i] + SLW / 2),
                new Vector3(L - bkT, GMT, p_qkw + expressarr[i] + SLW / 2), new Vector3(L - bkT, GMT, p_qkw + expressarr[i] - SLW / 2)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, [], 1, SLH);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());
            }
        }
        o.duan = [
            -L / 2, 0, -W / 2 - p_qkw / 2,
            L / 2, 0, -W / 2 - p_qkw / 2,
            L / 2, 0, W / 2 + p_qkw / 2,
            -L / 2, 0, W / 2 + p_qkw / 2,
        ]
        o.zhong = {
            L: [
                {
                    pointer: [L / 2, BKH / 2, 0],
                    center: [0, BKH / 2, 0]
                }
            ],
            W: [
                {
                    pointer: [0, BKH / 2, W / 2],
                    center: [0, BKH / 2, 0]
                }
            ],
            RL: [
                {
                    pointer: [-L / 2, BKH / 2, 0],
                    center: [0, BKH / 2, 0]
                }
            ],
            RW: [
                {
                    pointer: [0, BKH / 2, -W / 2],
                    center: [0, BKH / 2, 0]
                }
            ]
        }

        // for(i=0;i<vec.length;i+=9){
        //     if(vec.length > i+8){
        //         faceArr.push([new Vector3(vec[i],vec[i+1],vec[i+2]),
        //         new Vector3(vec[i+3],vec[i+4],vec[i+5]),new Vector3(vec[i+6],vec[i+7],vec[i+8])]);
        //     }
        // }
        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr };
        return [vec, indics, faceArr];
    }
    /**
     * 楼梯模板 支撑
     */
    public getStairSupportBoard(o: any): any[] {
        let i: number, j: number, boo: boolean = false;
        let vec = [];
        let vec2: Vector2;
        let L: number = Number(o.L), W: number = Number(o.W), GMT: number = o.GMT;
        let BKH: number = o.BKH, bkT: number = o.bkT, BKDia: number = o.BKDia;
        let BKKJMDis: number = o.BKKJMDis, HLW: number = o.HLW, HLH: number = o.HLH;

        let vertices: number[] = [];
        let vertices3: number[] = [];
        let pppps = [new Vector3(0, 0, 0), new Vector3(0, L, 0),
        new Vector3(0, L, W), new Vector3(0, 0, W)];
        let holes = [], expressarr = [];
        let tempObj, vvvv: Vector3;
        let faceArr: any = [];
        let indics = [];
        let holeIndex = null;
        holeIndex = [];
        let curr = vertices3.length / 3;
        let len = 0, lennn = 0, lennn2 = 0;
        holes = [];

        //下
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_xkkw], L, 2, o, AK.p_xkkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKKJMDis, y: value }) });
        pppps = [new Vector3(0, 0, 0), new Vector3(0, o[AK.XKH], 0), new Vector3(L, o[AK.XKH], 0), new Vector3(L, 0, 0)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 2, o[AK.SXKH]);
        tempObj.indics.reverse();
        indics.push(...tempObj.indics);
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());
        //上
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_skkw], L, 2, o, AK.p_skkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKKJMDis, y: value }) });
        pppps = [new Vector3(0, 0, (W - o[AK.SXKH])), new Vector3(0, o[AK.SKH], (W - o[AK.SXKH])), new Vector3(L, o[AK.SKH], (W - o[AK.SXKH])), new Vector3(L, 0, (W - o[AK.SXKH]))];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 2, o[AK.SXKH]);
        tempObj.indics.reverse();
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //左
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zkkw], W, 2, o, AK.p_zkkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, y: BKKJMDis, x: value }) });
        pppps = [new Vector3(0, 0, 0), new Vector3(0, o[AK.ZKH], 0), new Vector3(0, o[AK.ZKH], W), new Vector3(0, 0, W)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, o[AK.ZYKH]);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());
        //右
        holes = [];
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_ykkw], W, 2, o, AK.p_ykkw);
        expressarr.map((value) => { holes.push({ radius: BKDia / 2, y: BKKJMDis, x: value }) });
        pppps = [new Vector3((L - o[AK.ZYKH]), 0, 0), new Vector3((L - o[AK.ZYKH]), o[AK.YKH], 0), new Vector3((L - o[AK.ZYKH]), o[AK.YKH], W), new Vector3((L - o[AK.ZYKH]), 0, W)];
        tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, o[AK.ZYKH]);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //光面
        holes = [];
        if (o[AK.p_r1dw] && o[AK.p_r1dw] != '' && o[AK.p_r1dw].indexOf('(') > -1 && o[AK.p_r1dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r1], o[AK.p_r1dw], holes);
        }
        if (o[AK.p_r2dw] && o[AK.p_r2dw] != '' && o[AK.p_r2dw].indexOf('(') > -1 && o[AK.p_r2dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r2], o[AK.p_r2dw], holes);
        }
        if (o[AK.p_r3dw] && o[AK.p_r3dw] != '' && o[AK.p_r3dw].indexOf('(') > -1 && o[AK.p_r3dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r3], o[AK.p_r3dw], holes);
        }
        vertices = [];
        pppps = [new Vector3(0, o[AK.XKH], 0), new Vector3(L, o[AK.XKH], 0), new Vector3(L, o[AK.XKH], W), new Vector3(0, o[AK.XKH], W)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, -GMT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        // if (o['E' + AK.sldw] && o['E' + AK.sldw].length > 0) {
        //     for(i=0;i<o['E' + AK.sldw].length;i++){
        //         pppps = [new Vector3(o['E' + AK.sldw][i],bkT,0),new Vector3(o['E' + AK.sldw][i]+SLH,bkT,0),
        //         new Vector3(o['E' + AK.sldw][i]+SLH,L-2*bkT,0),new Vector3(o['E' + AK.sldw][i],L-2*bkT,0)];
        //         tempObj = MeshGeomLib.getFaceHoleNs(pppps,holes,2,SLW);
        //         indics.push(...tempObj.indics.map((value) => {value += vec.length/3;return value;}));
        //         vec.push(...tempObj.vec);
        //     }
        // }
        //横肋
        if (o[AK.p_hldw] && o[AK.p_hldw].length > 0) {
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_hldw], W, 2, o, AK.p_hldw);
            for (i = 0; i < expressarr.length; i++) {
                pppps = [new Vector3(o.ZYKH, expressarr[i], GMT), new Vector3(o.ZYKH, expressarr[i] + HLW, GMT),
                new Vector3(W - o.ZYKH, expressarr[i] + HLW, GMT), new Vector3(W - o.ZYKH, expressarr[i], GMT)];
                tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 2, HLH);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());
            }
        }
        //圆柱上面面
        len = vec.length / 3;
        let angle: number = o[AK.p_zcjj];

        //圆柱
        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zcdw], L, 2, o, AK.p_zcdw, 10001);
        expressarr.map((value) => { value = value - BKDia / 2 });
        lennn = 65 / Math.sin(angle * (Math.PI / 180));
        lennn2 = Math.cos(angle * (Math.PI / 180)) * lennn;
        vec2 = new Vector2(Math.cos((90 - angle) * (Math.PI / 180)) * 65, Math.sin((90 - angle) * (Math.PI / 180)) * 65);
        for (i = 0; i < expressarr.length; i++) {
            if (o[AK.p_zcxf]) {
                pppps = [new Vector3(expressarr[i] - (35 * (vec2.x) / 65), o[AK.XKH] - GMT, W / 2 - 50 / 2), new Vector3(expressarr[i] + lennn - (35 * (vec2.x) / 65), o[AK.XKH] - GMT, W / 2 - 50 / 2)
                    , new Vector3(expressarr[i] + (vec2.x) - (35 * (vec2.x) / 65), o[AK.XKH] - GMT - vec2.y, W / 2 - 50 / 2)];
                // vec.push(pppps[0].x, pppps[0].y, pppps[0].z);
                // vec.push(pppps[1].x, pppps[1].y, pppps[1].z);
                // vec.push(pppps[2].x, pppps[2].y, pppps[2].z);
                // indics.push(len, len+1, len + 2);
                // len += 3;

                // vec.push(pppps[0].x, pppps[0].y, pppps[0].z+50);
                // vec.push(pppps[1].x, pppps[1].y, pppps[1].z+50);
                // vec.push(pppps[2].x, pppps[2].y, pppps[2].z+50);
                // indics.push(len, len+1, len + 2);
                // len += 3;

                for (j = 0; j < pppps.length; j++) {
                    vvvv = j >= (pppps.length - 1) ? pppps[0] : pppps[j + 1];
                    vec.push(pppps[j].x, pppps[j].y, pppps[j].z);  //0
                    vec.push(vvvv.x, vvvv.y, vvvv.z);  //1

                    vec.push(vvvv.x, vvvv.y, vvvv.z + 50);   //2
                    vec.push(pppps[j].x, pppps[j].y, pppps[j].z + 50);   //3

                    indics.push(len + 1, len + 3, len);
                    indics.push(len + 1, len + 2, len + 3);
                    len += 4;
                }
            } else {
                pppps = [new Vector3(expressarr[i] - 50 / 2, o[AK.XKH] - GMT, W / 2 - lennn / 2), new Vector3(expressarr[i] - 50 / 2, o[AK.XKH] - GMT, W / 2 + lennn / 2)
                    , new Vector3(expressarr[i] - 50 / 2, o[AK.XKH] - GMT - vec2.y, W / 2 - lennn / 2 + vec2.x)];
                // vec.push(pppps[0].x, pppps[0].y, pppps[0].z);
                // vec.push(pppps[1].x, pppps[1].y, pppps[1].z);
                // vec.push(pppps[2].x, pppps[2].y, pppps[2].z);
                // indics.push(len, len+1, len + 2);
                // len += 3;

                // vec.push(pppps[0].x+50, pppps[0].y, pppps[0].z);
                // vec.push(pppps[1].x+50, pppps[1].y, pppps[1].z);
                // vec.push(pppps[2].x+50, pppps[2].y, pppps[2].z);
                // indics.push(len, len+1, len + 2);
                // len += 3;

                for (j = 0; j < pppps.length; j++) {
                    vvvv = j >= (pppps.length - 1) ? pppps[0] : pppps[j + 1];
                    vec.push(pppps[j].x, pppps[j].y, pppps[j].z);  //0
                    vec.push(vvvv.x, vvvv.y, vvvv.z);  //1

                    vec.push(vvvv.x + 50, vvvv.y, vvvv.z);   //2
                    vec.push(pppps[j].x + 50, pppps[j].y, pppps[j].z);   //3

                    indics.push(len + 1, len + 3, len);
                    indics.push(len + 1, len + 2, len + 3);
                    len += 4;
                }
            }

        }
        for (i = 0; i < expressarr.length; i++) {
            if (o[AK.p_zcxf]) {
                tempObj = MeshGeomLib.getCircleByXYZ3(o.ZCGdia / 2, new Vector3(expressarr[i], 0 + (o[AK.XKH] - (33 * vec2.y / 65) - GMT), W / 2), -o.zcgL, 1, angle);
            } else {
                tempObj = MeshGeomLib.getCircleByXYZ3(o.ZCGdia / 2, new Vector3(expressarr[i], 0 + (o[AK.XKH] - (33 * vec2.y / 65) - GMT), W / 2 - lennn / 2 + (35 * (vec2.x) / 65)), -o.zcgL, 1, angle, -1);
            }

            tempObj.indics.reverse();
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);
        }
        o.duan = [
            0, o.XKH, 0,
            L, o.XKH, 0,
            L, o.XKH, W,
            0, o.XKH, W,
        ]
        o.zhong = {
            L: [
                {
                    pointer: [L, o.XKH, W / 2],
                    center: [L / 2, o.XKH, W / 2]
                }
            ],
            W: [
                {
                    pointer: [L / 2, o.XKH, W],
                    center: [L / 2, o.XKH, W / 2]
                }
            ],
            RL: [
                {
                    pointer: [0, o.XKH, W / 2],
                    center: [L / 2, o.XKH, W / 2]
                }
            ],
            RW: [
                {
                    pointer: [L / 2, o.XKH, 0],
                    center: [L / 2, o.XKH, W / 2]
                }
            ]
        }

        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr };
        return [vec,indics,faceArr];
    }
    /**
     * 楼梯模板 转角支撑
     */
    public getStairConerSupportBoard(o: any): any[] {
        let i: number, j: number, boo: boolean = false;
        let vec = [];
        let vec2 = [], vec3 = [];
        let L: number = Number(o.L), W: number = Number(o.W), H: number = Number(o.H), GMT: number = o.GMT;
        let BKH: number = Number(o[AK.BKH]), bkT: number = o.bkT, BKDia: number = o.BKDia, ZCGdia: number = Number(o[AK.ZCGdia]);
        let BKKJMDis: number = o.BKKJMDis, HLW: number = o.HLW, HLH: number = o.HLH;
        let zyL: number = Number(o.zyL), yyL: number = Number(o.yyL), p_zcsl: number = Number(o[AK.p_zcsl]);

        let converangle: number = Number(o[AK.p_jiajiao]);
        let converangle2 = converangle > 90 ? converangle - 90 : 90 - converangle;
        let vertices: Vector3[] = [], vertices2: Vector3[] = [];
        let vertices3: Vector3[] = [], vertices4: Vector3[] = [];
        let pppps;
        let holes = [], expressarr = [];
        let tempObj;
        let faceArr: any = [];
        let xxx2 = BKH / Math.tan(converangle / 2 * (Math.PI / 180));
        let xxx = zyL * Math.sin(converangle2 * (Math.PI / 180));
        let zzz = -(zyL * Math.cos(converangle2 * (Math.PI / 180)));
        if (converangle > 90) {
            pppps = [new Vector3(yyL, 0, 0), new Vector3(0, 0, 0), new Vector3(-xxx, zzz, 0)];
        } else if (converangle === 90) {
            pppps = [new Vector3(yyL, 0, 0), new Vector3(0, 0, 0), new Vector3(0, zzz, 0)];
        }
        else {
            pppps = [new Vector3(yyL, 0, 0), new Vector3(0, 0, 0), new Vector3(xxx, zzz, 0)];
        }
        let veccc = MeshGeomLib.CalculateNormal(pppps, 1);
        let pppps2 = MeshGeomLib.pointExpand(pppps, veccc, -BKH, false);
        let pppps3 = MeshGeomLib.pointExpand(pppps, veccc, -bkT, false);
        // let pppps4 = MeshGeomLib.pointExpand(pppps2, veccc, bkT, false);

        let indics = [];
        let holeIndex = null;
        holeIndex = [];
        let curr = 0;//vertices3.length / 3;
        let len = 0;
        holes = [];
        pppps.map((value) => { vertices.push(new Vector3(value.x, value.y, value.z + H)) });
        pppps2.map((value) => { vertices2.push(new Vector3(value.x, value.y, value.z + H)) });
        pppps3.map((value) => { vertices3.push(new Vector3(value.x, value.y, value.z + H)) });
        // pppps4.map((value) => {vertices4.push(new Vector3(value.x,value.y,value.z))});

        let v1 = pppps[1].clone().sub(pppps[0]).normalize();
        v1 = v1.setLength(Math.abs(bkT)).add(pppps[0]);
        let v2 = pppps[pppps.length - 2].clone().sub(pppps[pppps.length - 1]).normalize();
        v2 = v2.setLength(Math.abs(bkT)).add(pppps[pppps.length - 1]);
        let v3 = pppps2[1].clone().sub(pppps2[0]).normalize();
        v3 = v3.setLength(Math.abs(bkT)).add(pppps2[0]);
        let v4 = pppps2[pppps2.length - 2].clone().sub(pppps2[pppps2.length - 1]).normalize();
        v4 = v4.setLength(Math.abs(bkT)).add(pppps2[pppps2.length - 1]);

        // pppps = [...pppps,...vertices.reverse()];
        tempObj = MeshGeomLib.getFaceHoleNs3([pppps[0], pppps[1], vertices[1], vertices[0]], [pppps3[0], pppps3[1], vertices3[1], vertices3[0]], holes, 1, 0);
        tempObj.indics.reverse();
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);
        tempObj = MeshGeomLib.getFaceHoleNs3([pppps[1], pppps[2], vertices[2], vertices[1]], [pppps3[1], pppps3[2], vertices3[2], vertices3[1]], holes, 3, 0);
        tempObj.indics.reverse();
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);
        let minxyz, type: number = 0, maxxxx: number = 0, maxyyy: number = 0;
        for (i = 0; i < vertices.length; i++) {
            holes = [];
            if (i === 0) {
                vec2 = [pppps[i], pppps2[i], new Vector3(vertices2[i].x, vertices2[i].y, vertices2[i].z),
                new Vector3(vertices[i].x, vertices[i].y, vertices[i].z)];
                vec3 = [v1, v3, new Vector3(v3.x, v3.y, v3.z + H),
                    new Vector3(v1.x, v1.y, v1.z + H)];

                expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_ykkw], H, 2, o, AK.p_ykkw);
                expressarr.map((value) => { holes.push({ radius: BKDia / 2, y: value, x: -(BKH - BKKJMDis) }) });
                tempObj = MeshGeomLib.getFaceHoleNs3(vec2, vec3, holes, 3, 0, new Vector3(1, 1, 1));
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);
            } else if (i === vertices.length - 1) {
                vec2 = [pppps[i], pppps2[i], new Vector3(vertices2[i].x, vertices2[i].y, vertices2[i].z),
                new Vector3(vertices[i].x, vertices[i].y, vertices[i].z)];
                vec3 = [v2, v4, new Vector3(v4.x, v4.y, v4.z + H),
                    new Vector3(v2.x, v2.y, v2.z + H)];
                expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zkkw], H, 2, o, AK.p_zkkw);
                expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: value, y: BKH - BKKJMDis, h: 0, l: zyL }) });
                if (converangle >= 90) {
                    tempObj = MeshGeomLib.getFaceHoleNs3(vec2, vec3, holes, 3, converangle === 90 ? 0 : converangle, new Vector3(1, 1, -1));
                } else {
                    tempObj = MeshGeomLib.getFaceHoleNs3(vec2, vec3, holes, 3, converangle, new Vector3(1, 1, 1));
                }
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);
            }
            if (i < vertices.length - 1) {
                holes = [];
                len = i > 0 ? zyL : yyL;
                let ps1 = [pppps[i], pppps[i + 1], pppps2[i + 1], pppps2[i]];
                let ps2 = [new Vector3(pppps[i].x, pppps[i].y, pppps[i].z + bkT), new Vector3(pppps[i + 1].x, pppps[i + 1].y, pppps[i + 1].z + bkT)
                    , new Vector3(pppps2[i + 1].x, pppps2[i + 1].y, pppps2[i + 1].z + bkT), new Vector3(pppps2[i].x, pppps2[i].y, pppps2[i].z + bkT)];
                maxxxx = (vertices2[1].x - vertices[1].x) / 2;
                maxxxx = xxx2;
                expressarr = AModelFmulaUtils.getHolesbyExpress(i > 0 ? o[AK.p_szykw] : o[AK.p_syykw], len, 2, o, i > 0 ? AK.p_szykw : AK.p_syykw);
                expressarr.map((value, index) => {
                    if (index == 0) {
                        if ((value - BKDia / 2) > maxxxx) {
                            holes.push({ radius: BKDia / 2, y: i > 0 ? BKH - BKKJMDis : BKKJMDis, x: value })
                        }
                    } else {
                        if ((value + BKDia / 2) < len) {
                            holes.push({ radius: BKDia / 2, y: i > 0 ? BKH - BKKJMDis : BKKJMDis, x: value })
                        }
                    }
                    // if((value+BKDia) < len-maxxxx){
                    //     holes.push({radius:BKDia/2,y:i>0?BKH-BKKJMDis:BKKJMDis,x:value})
                    // }
                });
                type = i > 0 ? 2 : 2;
                if (converangle > 90) {
                    tempObj = MeshGeomLib.getFaceHoleNs3(ps1, ps2, holes, 2, i > 0 ? converangle : 0, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                } else if (converangle === 90) {
                    tempObj = MeshGeomLib.getFaceHoleNs3(ps1, ps2, holes, 2, 0, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                }
                else {
                    tempObj = MeshGeomLib.getFaceHoleNs3(ps1, ps2, holes, 2, i > 0 ? converangle : 0, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                }
                tempObj.indics.reverse();
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                holes = [];
                let ps3 = [vertices[i], vertices[i + 1], vertices2[i + 1], vertices2[i]];
                let ps4 = [new Vector3(vertices[i].x, vertices[i].y, vertices[i].z - bkT), new Vector3(vertices[i + 1].x, vertices[i + 1].y, vertices[i + 1].z - bkT)
                    , new Vector3(vertices2[i + 1].x, vertices2[i + 1].y, vertices2[i + 1].z - bkT), new Vector3(vertices2[i].x, vertices2[i].y, vertices2[i].z - bkT)];
                // maxxxx = (vertices2[1].x - vertices[1].x)/2;
                expressarr = AModelFmulaUtils.getHolesbyExpress(i > 0 ? o[AK.p_xzykw] : o[AK.p_xyykw], len, 2, o, i > 0 ? AK.p_xzykw : AK.p_xyykw);
                expressarr.map((value, index) => {
                    if (index == 0) {
                        if ((value - BKDia / 2) > maxxxx) {
                            holes.push({ radius: BKDia / 2, y: i > 0 ? BKH - BKKJMDis : BKKJMDis, x: value })
                        }
                    } else {
                        if ((value + BKDia / 2) < len) {
                            holes.push({ radius: BKDia / 2, y: i > 0 ? BKH - BKKJMDis : BKKJMDis, x: value })
                        }
                    }
                });
                if (converangle > 90) {
                    tempObj = MeshGeomLib.getFaceHoleNs3(ps3, ps4, holes, 2, i > 0 ? converangle : 0, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                } else if (converangle === 90) {
                    tempObj = MeshGeomLib.getFaceHoleNs3(ps3, ps4, holes, 2, 0, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                }
                else {
                    tempObj = MeshGeomLib.getFaceHoleNs3(ps3, ps4, holes, 2, i > 0 ? converangle : 0, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                }
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);
            }
        }


        //圆柱
        if (p_zcsl > 0) {
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zydw], zyL, 2, o, AK.p_zydw);
            expressarr.map((value) => { value = value - BKDia / 2 });
            o[AK.p_zydw] = o[AK.p_zydw].split(',')[0];
            let lennn = converangle === 90 ? 65 : 65 / Math.sin(converangle2 * (Math.PI / 180));
            let lennn2 = converangle === 90 ? 1 : Math.cos(converangle2 * (Math.PI / 180)) * lennn;
            len = vec.length / 3;
            for (i = 0; i < expressarr.length; i++) {
                v1 = pppps[pppps.length - 1].clone().sub(pppps[pppps.length - 2]).normalize();
                v2 = v1.clone().setLength(expressarr[i] - lennn / 2).add(pppps[pppps.length - 2]);
                v3 = v1.clone().setLength(expressarr[i] + lennn / 2).add(pppps[pppps.length - 2]);
                v2.z = v3.z = H / 2 - 50 / 2;
                v4 = v2.clone();
                v4.y = v4.y - lennn2;
                vertices = [v2, v3, v4];
                // vec.push(vertices[0].x, vertices[0].y, vertices[0].z);
                // vec.push(vertices[1].x, vertices[1].y, vertices[1].z);
                // vec.push(vertices[2].x, vertices[2].y, vertices[2].z);
                // indics.push(len, len+1, len + 2);
                // len += 3;

                // vec.push(vertices[0].x, vertices[0].y, vertices[0].z+50);
                // vec.push(vertices[1].x, vertices[1].y, vertices[1].z+50);
                // vec.push(vertices[2].x, vertices[2].y, vertices[2].z+50);
                // indics.push(len, len+1, len + 2);
                // len += 3;

                for (j = 0; j < vertices.length; j++) {
                    v1 = j >= (vertices.length - 1) ? vertices[0] : vertices[j + 1];
                    vec.push(vertices[j].x, vertices[j].y, vertices[j].z);  //0
                    vec.push(v1.x, v1.y, v1.z);  //1

                    vec.push(v1.x, v1.y, v1.z + 50);   //2
                    vec.push(vertices[j].x, vertices[j].y, vertices[j].z + 50);   //3

                    indics.push(len + 1, len + 3, len);
                    indics.push(len + 1, len + 2, len + 3);
                    len += 4;
                }
                tempObj = MeshGeomLib.getCircleByXYZ3(o.ZCGdia / 2, new Vector3((v3.x + v2.x) / 2, v4.y - o[AK.zcgL], H / 2), o[AK.zcgL], 1);
                tempObj.indics.reverse();
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);
            }
        }

        expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_yydw], yyL, 2, o, AK.p_yydw);
        o[AK.p_yydw] = o[AK.p_yydw].split(',')[0];
        for (i = 0; i < expressarr.length; i++) {
            tempObj = MeshGeomLib.getCircleByXYZ3(ZCGdia / 2, new Vector3(expressarr[i], 0 - GMT - o[AK.zcgL], H / 2), o[AK.zcgL], 1);
            tempObj.indics.reverse();
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);
        }
        v2 = pppps[pppps.length - 2].clone().sub(pppps[pppps.length - 1]).normalize();
        v2 = v2.setLength(Math.abs(bkT)).add(pppps[pppps.length - 1]);
        for (i = 0; i < vec.length; i += 9) {
            if (vec.length > i + 8) {
                faceArr.push([new Vector3(vec[i], vec[i + 1], vec[i + 2]),
                new Vector3(vec[i + 3], vec[i + 4], vec[i + 5]), new Vector3(vec[i + 6], vec[i + 7], vec[i + 8])]);
            }
        }
        o.duan = [
            pppps[0].x, pppps[0].y, pppps[0].z,
            pppps[1].x, pppps[1].y, pppps[1].z,
            pppps[2].x, pppps[2].y, pppps[2].z,
            vertices[0].x, vertices[0].y, vertices[0].z,
            vertices[1].x, vertices[1].y, vertices[1].z,
            vertices[2].x, vertices[2].y, vertices[2].z,
        ]
        o.zhong = {
            yyL: [
                {
                    pointer: [yyL, 0, H / 2],
                    center: [0, 0, H / 2]
                },
                // {
                //     pointer: [zx2.x, 0, zx2.y],
                //     center: [ztp.x, 0, ztp.y]
                // }
            ],
            zyL: [
                {
                    pointer: [-xxx, zzz, H / 2],
                    center: [0, 0, H / 2]
                },
                // {
                //     pointer: [YYL, -H / 2, 0],
                //     center: [YYL / 2, -H / 2, 0]
                // }
            ]
        }
        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr };
        return [vec,indics,faceArr];
    }

    /**
     * 
     * 楼梯模板 隔板
     */
    public getStairHulkhead(o: any): any[] {
        let i: number, j: number, boo: boolean = false, tempObj: any, expressarr: any, pppps: Vector3[];
        let L: number = Number(o.L), W: number = Number(o.W), H: number = Number(o.H), GMT: number = o.GMT;
        let BKH: number = Number(o[AK.BKH]), bkT: number = o[AK.bkT], BKDia: number = o.BKDia, LL: number = o[AK.LL];
        let BKKJMDis: number = o.BKKJMDis, p_isqL: number = o[AK.p_isqL], p_qktype: number = o[AK.p_qktype];
        let p_pkl: number = Number(o[AK.p_pkl]), p_pkw: number = Number(o[AK.p_pkw]);
        let vec = [];
        let indics = [];
        let holes = [];
        let vertices = [];
        let faceArr: any = [];
        let pkLen = p_qktype > 0 ? p_pkl : 0;
        let shuX: number = p_isqL > 0 ? BKH - BKKJMDis : W - BKH + BKKJMDis;
        // let badaf = [[new Vector2()],[],[new Vector2()],[]];
        //左右
        if (p_isqL > 0) {
            holes = [];
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zkkw], LL, 2, o, AK.p_zkkw);
            expressarr.map((value) => {
                if (value + BKDia / 2 < LL) {
                    holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value })
                }
            });
            pppps = [new Vector3(0, 0, 0), new Vector3(0, 0, H), new Vector3(0, LL, H), new Vector3(0, LL, 0)];
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());

            holes = [];
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_ykkw], L - pkLen, 2, o, AK.p_ykkw);
            expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value }) });
            pppps = [new Vector3((W - bkT), 0, 0), new Vector3((W - bkT), 0, H), new Vector3((W - bkT), BKH, H), new Vector3((W - bkT), BKH, BKH),
            new Vector3((W - bkT), L - pkLen, BKH), new Vector3((W - bkT), L - pkLen, 0)];
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
        } else {
            holes = [];
            pppps = [new Vector3(0, 0, 0), new Vector3(0, 0, H), new Vector3(0, BKH, H), new Vector3(0, BKH, BKH)
                , new Vector3(0, L - pkLen, BKH), new Vector3(0, L - pkLen, 0)];
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_zkkw], L - pkLen, 2, o, AK.p_zkkw);
            expressarr.map((value) => { holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value }) });
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());

            holes = [];
            pppps = [new Vector3((W - bkT), 0, 0), new Vector3((W - bkT), 0, H), new Vector3((W - bkT), LL, H), new Vector3((W - bkT), LL, 0)];
            expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_ykkw], LL, 2, o, AK.p_ykkw);
            expressarr.map((value) => {
                if (value + BKDia / 2 < LL) {
                    holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: value })
                }
            });
            tempObj = MeshGeomLib.getFaceHoleNs(pppps, holes, 3, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
        }

        //平孔 竖孔
        holes = [];
        MeshGeomLib.getHoles((BKDia).toString(), o['C' + AK.Lpk], holes, BKH - BKKJMDis, 0, W, o, 'C' + AK.Lpk, null, p_isqL > 0 ? true : false);
        MeshGeomLib.getHoles((BKDia).toString(), o['C' + AK.Lsk], holes, shuX, 1, LL, o, 'C' + AK.Lsk);
        if (p_isqL > 0) {
            pppps = [new Vector3(0, 0, H), new Vector3(0, LL, H), new Vector3(BKH, LL, H), new Vector3(BKH, BKH, H),
            new Vector3(W, BKH, H), new Vector3(W, 0, H)];
        } else {
            pppps = [new Vector3(0, 0, H), new Vector3(0, BKH, H), new Vector3(W - BKH, BKH, H), new Vector3(W - BKH, LL, H),
            new Vector3(W, LL, H), new Vector3(W, 0, H)];
        }
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //底面
        holes = [];
        pppps = [new Vector3(0, 0, 0), new Vector3(W, 0, 0), new Vector3(W, 0, H), new Vector3(0, 0, H)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, bkT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());

        //光面
        holes = [];
        if (o[AK.p_r1dw] && o[AK.p_r1dw] != '' && o[AK.p_r1dw].indexOf('(') > -1 && o[AK.p_r1dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r1], o[AK.p_r1dw], holes);
        }
        if (o[AK.p_r2dw] && o[AK.p_r2dw] != '' && o[AK.p_r2dw].indexOf('(') > -1 && o[AK.p_r2dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r2], o[AK.p_r2dw], holes);
        }
        if (o[AK.p_r3dw] && o[AK.p_r3dw] != '' && o[AK.p_r3dw].indexOf('(') > -1 && o[AK.p_r3dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r3], o[AK.p_r3dw], holes);
        }
        //切口
        if (p_qktype === 1) {
            pppps = [new Vector3(0, 0, 0), new Vector3(W, 0, 0), new Vector3(W, L, 0), new Vector3(p_pkw, L, 0),
            new Vector3(p_pkw, L - p_pkl, 0), new Vector3(0, L - p_pkl, 0)];
        } else if (p_qktype === 2) {
            pppps = [new Vector3(0, 0, 0), new Vector3(W, 0, 0), new Vector3(W, L - p_pkl, 0), new Vector3(W - p_pkw, L - p_pkl, 0),
            new Vector3(W - p_pkw, L, 0), new Vector3(0, L, 0)];
        } else {
            pppps = [new Vector3(0, 0, 0), new Vector3(W, 0, 0), new Vector3(W, L, 0), new Vector3(0, L, 0)];
        }
        // pppps = [new Vector3(0,0,0),new Vector3(W,0,0),new Vector3(W,L,0),new Vector3(0,L,0)];
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, GMT);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        faceArr.push(pppps.concat());
        o.duan = [
            0, 0, 0,
            W, 0, 0,
            W, L, 0,
            0, L, 0,
        ]
        o.zhong = {
            L: [
                {
                    pointer: [W / 2, L, 0],
                    center: [W / 2, L / 2, 0]
                }
            ],
            W: [
                {
                    pointer: [W, L / 2, 0],
                    center: [W / 2, L / 2, 0]
                }
            ],
            RL: [
                {
                    pointer: [W / 2, 0, 0],
                    center: [W / 2, L / 2, 0]
                }
            ],
            RW: [
                {
                    pointer: [0, L / 2, 0],
                    center: [W / 2, L / 2, 0]
                }
            ]
        }

        // for(i=0;i<vec.length;i+=9){
        //     if(vec.length > i+8){
        //         faceArr.push([new Vector3(vec[i],vec[i+1],vec[i+2]),
        //         new Vector3(vec[i+3],vec[i+4],vec[i+5]),new Vector3(vec[i+6],vec[i+7],vec[i+8])]);
        //     }
        // }
        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr };
        return [vec,indics,faceArr];
    }
    /**
     * 生成楼梯狗牙几何体
     */
    public getStairDog(o: any): any[] {
        let i: number, j: number, boo: boolean = false, tempObj: any, expressarr: any, pppps: Vector3[], pppps2: Vector3[];
        let L: number = Number(o.L), W: number = Number(o.W), H: number = Number(o.H), GMT: number = o.GMT;
        let BKH: number = Number(o[AK.BKH]), bkT: number = o[AK.bkT], BKDia: number = Number(o[AK.BKDia]), LL: number = o[AK.LL];
        let BKKJMDis: number = Number(o[AK.BKKJMDis]), p_isqL: number = o[AK.p_isqL], p_qktype: number = o[AK.p_qktype];
        let p_pkl: number = Number(o[AK.p_pkl]), p_pkw: number = Number(o[AK.p_pkw]), pbW: number = Number(o[AK.pbW]);
        let p_isstaircmfx: number = Number(o[AK.p_isstaircmfx]), p_isqdpbpq: number = Number(o[AK.p_iswbpbpq]);
        let p_iswbpbpq: number = Number(o[AK.p_isqdpbpq]), p_iswbcc: number = Number(o[AK.p_iswbcc]), p_iswbccfb: number = Number(o[AK.p_iswbccfb]);
        let p_wbccW: number = Number(o[AK.p_wbccW]), p_wbccL: number = Number(o[AK.p_wbccL]), p_wbccH: number = Number(o[AK.p_wbccH]), p_stairendH: number = Number(o[AK.p_stairendH]);
        let vec = [];
        let indics = [];
        let holes = [];
        let vertices = [];
        let pkLen = p_qktype > 0 ? p_pkl : 0;
        let stairw: number = W, stairh: number = Number(o[AK.p_stairH]), stairl: number = Number(o[AK.p_stairW]), stairnum: number = Number(o[AK.TBS]);
        let angle: number = Math.atan2(stairh, stairl);
        let angle2: number = Math.asin(BKH / 200);
        let anglenum3: number = (200 / Math.sin(Math.PI / 2 - angle)) - stairh;
        let anglenum4 = anglenum3 / Math.tan(angle);
        let anglenum5 = pbW / Math.sin(angle);
        let anglenum: number = (anglenum3 + stairh) / Math.tan(angle) - stairl;
        let anglenum2: number = BKH * Math.tan(angle);
        let holenum: number = BKKJMDis + BKDia / 2;
        let nummmm: number = 0, tempH: number = 0, tempL: number = 0, nummmm2: number = 0;
        let nummmm3: number = bkT * Math.tan(angle), nummmm4: number = 0, nummmm5: number = 0, nummmm6: number = 0;
        let nummmm7: number = pbW / Math.sin(Math.PI / 2 - angle), nummmm8: number = 0;
        let vv: Vector3;
        let faceArr: any = [];
        o['p_stairadd'] = anglenum;
        o['tw'] = 200 + nummmm7;
        o['tl'] = stairnum * stairl + anglenum;

        let typee: number = 0, startx: number = 0, endx: number = 0, starty: number = 0, startz: number = 0;
        o.duan = [];
        // anglenum = anglenum4;
        for (i = 0; i < stairnum; i++) {
            tempH = i * stairh;
            tempL = i === 0 ? i * stairl : i * stairl + anglenum;
            //最后一阶增高变化的长
            if (p_stairendH > stairh && i === stairnum - 1 && !p_isqdpbpq) {
                nummmm4 = (anglenum + stairl) * Math.tan(angle);
                if (p_stairendH > nummmm4) {
                    p_stairendH = nummmm4;
                }
                nummmm4 = (p_stairendH - stairh);
                nummmm5 = p_stairendH / Math.tan(angle) - (stairh / Math.tan(angle));
            }

            nummmm = i === 0 ? anglenum : 0;
            nummmm6 = i === 0 ? anglenum - BKH / Math.tan(angle) : 0;
            startx = o[AK.p_isstaircmfx] > 0 ? 0 : W - bkT;
            if (i === stairnum - 1 && !p_isqdpbpq) {
                pppps = [new Vector3(startx, tempH, tempL), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm), new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL + nummmm),
                new Vector3(startx, stairh + tempH + nummmm4, stairl - BKH + tempL + nummmm), new Vector3(startx, BKH + tempH, stairl - BKH + tempL + nummmm), new Vector3(startx, BKH + tempH, nummmm + tempL)];
            } else {
                if (!p_iswbpbpq && i === 0) {
                    pppps = [new Vector3(startx, tempH, tempL + nummmm), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm), new Vector3(startx, stairh + tempH + anglenum3, stairl + tempL + nummmm),
                    new Vector3(startx, stairh + tempH + (anglenum3 - anglenum2), stairl - BKH + tempL + nummmm), new Vector3(startx, BKH + tempH, stairl - BKH + tempL + nummmm), new Vector3(startx, BKH + tempH, nummmm + tempL)];
                } else {
                    pppps = [new Vector3(startx, tempH, tempL), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm), new Vector3(startx, stairh + tempH + anglenum3 + nummmm4, stairl + tempL + nummmm),
                    new Vector3(startx, stairh + tempH + (anglenum3 - anglenum2) + nummmm4, stairl - BKH + tempL + nummmm), new Vector3(startx, BKH + tempH, stairl - BKH + tempL + nummmm), new Vector3(startx, BKH + tempH, nummmm + tempL - nummmm6)];
                }
            }
            //平孔 竖孔
            holes = [];
            MeshGeomLib.getHoles((BKDia).toString(), o['C' + AK.Lpk], holes, BKH - BKKJMDis, 0, stairl, o, 'C' + AK.Lpk, [tempL + nummmm, tempH]);
            MeshGeomLib.getHoles((BKDia).toString(), o['C' + AK.Lsk], holes, BKKJMDis, 1, stairh, o, 'C' + AK.Lsk, [tempL + (stairl + nummmm - BKH), tempH]);

            tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT, 1);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());

            //底
            holes = [];
            pppps = [new Vector3(0, tempH, p_iswbpbpq > 0 ? tempL : tempL + nummmm), new Vector3(0 + W, tempH, p_iswbpbpq > 0 ? tempL : tempL + nummmm),
            new Vector3(0 + W, tempH, stairl + tempL + nummmm), new Vector3(0, tempH, tempL + stairl + nummmm)];
            tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
            
            //
            nummmm2 = i === stairnum - 1 && !p_isqdpbpq ? 0 : anglenum3;
            pppps = [new Vector3(0, 0 + tempH, stairl + tempL - bkT + nummmm), new Vector3(0, 0 + tempH, stairl + tempL + nummmm),
            new Vector3(0, stairh + tempH + nummmm2 + nummmm4, stairl + tempL + nummmm), new Vector3(0, stairh + tempH + nummmm2 - nummmm3 + nummmm4, stairl + tempL - bkT + nummmm)];
            tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, W);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());

            tempL = i * stairl;
            nummmm = i === 0 ? anglenum : anglenum;
            startx = o[AK.p_isstaircmfx] > 0 ? W - bkT : 0;
            if (p_isqdpbpq > 0 && i === stairnum - 1) {
                pppps = [new Vector3(startx, tempH, tempL), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm), new Vector3(startx, stairh + tempH + anglenum3 + nummmm4, stairl + tempL + nummmm),
                new Vector3(startx, stairh + tempH + (anglenum3 - anglenum2) + nummmm4, stairl - BKH + tempL + nummmm)];
            } else {
                if (!p_iswbpbpq && i === 0) {
                    pppps = [new Vector3(startx, tempH, tempL + nummmm), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm),
                    new Vector3(startx, stairh + tempH, stairl + tempL + nummmm), new Vector3(startx, stairh + tempH, i === 0 ? stairl : stairl + tempL)
                        , new Vector3(startx, anglenum3, tempL + nummmm)];//
                } else {
                    pppps = [new Vector3(startx, tempH, tempL), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm),
                    new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL + nummmm), new Vector3(startx, stairh + tempH + nummmm4, i === 0 ? stairl : stairl + tempL + nummmm5)];//
                }
            }

            tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);

            faceArr.push(pppps.concat());
            if (i === stairnum - 1) {
                nummmm = p_iswbpbpq === 0 ? anglenum3 : 0;//高
                nummmm2 = p_iswbpbpq === 0 ? anglenum : 0;//长
                //下
                holes = [];
                startx = p_isstaircmfx > 0 ? W - BKH : 0;
                endx = p_isstaircmfx > 0 ? W : BKH;
                // startz = p_iswbpbpq > 0?0:ang
                MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dipbfbk], holes, BKH - BKKJMDis, 1, nummmm7, o, AK.p_dipbfbk, [startx, nummmm]);
                pppps = [new Vector3(startx, nummmm, nummmm2), new Vector3(startx, nummmm + nummmm7, nummmm2),
                new Vector3(endx, nummmm + nummmm7, nummmm2), new Vector3(endx, nummmm, nummmm2)];
                tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);
                faceArr.push(pppps.concat());

                starty = p_isqdpbpq > 0 ? stairh + tempH + anglenum3 + nummmm4 : stairh + tempH + nummmm4;
                startz = p_isqdpbpq > 0 ? stairl + tempL + anglenum4 + nummmm5 : stairl + tempL + nummmm5;
                //顶
                holes = [];
                if (p_isqdpbpq) {
                    MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dingpbfbk], holes, BKH - BKKJMDis, 1, nummmm7, o, AK.p_dingpbfbk, [startx, starty]);
                    pppps = [new Vector3(endx, starty, startz - bkT), new Vector3(startx, starty, startz - bkT),
                    new Vector3(startx, starty + nummmm7 - bkT, startz - bkT), new Vector3(endx, starty + nummmm7 - bkT, startz - bkT)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
                } else {
                    MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dingpbfbk], holes, BKH - BKKJMDis, 1, anglenum5, o, AK.p_dingpbfbk, [startx, stairl + tempL - anglenum5 + nummmm5]);
                    pppps = [new Vector3(endx, stairh + tempH - bkT + nummmm4, stairl + tempL - anglenum5 + nummmm5), new Vector3(startx, stairh + tempH - bkT + nummmm4, stairl + tempL - anglenum5 + nummmm5),
                    new Vector3(startx, stairh + tempH - bkT + nummmm4, stairl + tempL + nummmm5), new Vector3(endx, stairh + tempH - bkT + nummmm4, stairl + tempL + nummmm5)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, bkT);
                }
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());
                holes = [];
                

                //下
                nummmm6 = (starty) / Math.tan(angle);
                pppps = [new Vector3(startx, nummmm, nummmm2), new Vector3(startx, nummmm + bkT, nummmm2), new Vector3(startx, starty, startz - bkT), new Vector3(startx, starty, nummmm6)];
                tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, BKH);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);
                faceArr.push(pppps.concat());
                o[AK.gyL] =  (new Vector3(startx, starty, startz - bkT).sub(new Vector3(startx, nummmm + bkT, nummmm2))).length();
                o[AK.gyW] = 200 + pbW;
                // o[AK.gyL].push(startx, nummmm, nummmm2,startx, nummmm + bkT, nummmm2,startx, starty, startz - bkT,startx, starty, nummmm6);
                //上
                starty = p_isqdpbpq > 0 ? stairh + tempH + anglenum3 + nummmm7 : stairh + tempH + nummmm4;
                startz = p_isqdpbpq > 0 ? stairl + tempL + anglenum4 : stairl + tempL - anglenum5 + nummmm5;
                nummmm3 = Math.sqrt(Math.pow(starty - nummmm - nummmm7, 2) + Math.pow(startz - nummmm2, 2));
                expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_skkw], nummmm3, 2, o, AK.p_skkw);
                expressarr.map((value) => {
                    if ((value) < nummmm3) {
                        if (p_iswbpbpq) {
                            holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: nummmm2 + value, h: nummmm7, l: startx })
                        } else {
                            holes.push({ radius: BKDia / 2, x: BKH - BKKJMDis, y: Math.sqrt(nummmm2 * nummmm2 + (nummmm) * (nummmm)) + value, h: nummmm7, l: startx })
                        }
                    }
                });
                pppps = [new Vector3(startx, nummmm + nummmm7 - bkT, nummmm2), new Vector3(endx, nummmm + nummmm7 - bkT, nummmm2), new Vector3(endx, starty - bkT, startz), new Vector3(startx, starty - bkT, startz)];
                pppps2 = [new Vector3(startx, nummmm + nummmm7, nummmm2), new Vector3(endx, nummmm + nummmm7, nummmm2), new Vector3(endx, starty, startz), new Vector3(startx, starty, startz)];
                vv = pppps2[2].clone().sub(pppps2[1]);
                angle2 = Math.atan2(vv.y, vv.z);
                tempObj = MeshGeomLib.getFaceHoleNs3(pppps2, pppps, holes, 1, angle2 * 180 / Math.PI, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                // tempObj.indics.reverse();
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());
                faceArr.push(pppps2.concat());
                o.duan.push(startx, nummmm + nummmm7, nummmm2,endx, nummmm + nummmm7, nummmm2,endx, starty, startz,startx, starty, startz);
                // tempObj = MeshGeomLib.getFaceHoleNs2(pppps,holes,1,bkT);
                // indics.push(...tempObj.indics.map((value) => {value += vec.length/3;return value;}));
                // vec.push(...tempObj.vec);

                holes = [];
                //侧
                startx = p_isstaircmfx > 0 ? W - bkT : 0;
                if (p_isqdpbpq > 0) {
                    pppps = [new Vector3(startx, nummmm, nummmm2), new Vector3(startx, starty - nummmm7, startz),
                    new Vector3(startx, starty, startz), new Vector3(startx, nummmm + nummmm7, nummmm2)];
                } else {
                    pppps = [new Vector3(startx, nummmm, nummmm2), new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL + nummmm5),
                    new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL - anglenum5 + nummmm5), new Vector3(startx, nummmm + nummmm7, nummmm2)];
                }
                tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                faceArr.push(pppps.concat());

                // MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dingpbfbk], holes,BKH/2,1,anglenum4,o,AK.p_dingpbfbk,[W-BKH,stairl+tempL]);
                if (!p_isqdpbpq) {
                    if (p_isstaircmfx > 0) {
                        pppps = [new Vector3(W, stairh + tempH - bkT + nummmm4, stairl + tempL + nummmm5), new Vector3(W, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4), new Vector3(0, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4),
                        new Vector3(0, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4 - BKH), new Vector3(W - BKH, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4 - BKH),
                        new Vector3(W - BKH, stairh + tempH - bkT + nummmm4, stairl + tempL + nummmm5)];
                        o.duan.push(W, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4,0, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4);
                    } else {
                        pppps = [new Vector3(0, stairh + tempH - bkT + nummmm4, stairl + tempL + nummmm5), new Vector3(0, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4), new Vector3(W, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4),
                        new Vector3(W, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4 - BKH), new Vector3(BKH, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4 - BKH),
                        new Vector3(BKH, stairh + tempH - bkT + nummmm4, stairl + tempL + nummmm5)];
                        o.duan.push(0, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4,W, stairh + tempH - bkT + nummmm4, stairl + tempL + anglenum4);
                    }
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, bkT);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                    faceArr.push(pppps.concat());
                }

                if (!p_iswbpbpq) {
                    pppps = [new Vector3(p_isstaircmfx > 0 ? W : 0, 0, nummmm2), new Vector3(p_isstaircmfx > 0 ? W : 0, nummmm, nummmm2),
                    new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, nummmm, nummmm2), new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, BKH, nummmm2),
                    new Vector3(p_isstaircmfx > 0 ? 0 : W, BKH, nummmm2), new Vector3(p_isstaircmfx > 0 ? 0 : W, 0, nummmm2)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                    faceArr.push(pppps.concat());
                }

                if (p_iswbcc === 0 && p_iswbpbpq > 0) {
                    startx = p_isstaircmfx > 0 ? W - BKH : 0;
                    endx = p_isstaircmfx > 0 ? W : BKH;
                    // if(p_iswbccfb){
                    pppps = [new Vector3(startx, -p_wbccH, 0), new Vector3(endx, -p_wbccH, 0),
                    new Vector3(endx, 0, 0), new Vector3(startx, 0, 0)];
                    // }else{
                    //     pppps = [new Vector3(p_isstaircmfx > 0?W-p_wbccL:0,-p_wbccH,0),new Vector3(p_isstaircmfx > 0?W:p_wbccL,-p_wbccH,0),
                    //         new Vector3(p_isstaircmfx > 0?W:p_wbccL,0,0),new Vector3(p_isstaircmfx > 0?W-p_wbccL:0,0,0)];
                    // }
                    holes = [];
                    MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_wbcck], holes, BKH - BKKJMDis, 1, p_wbccH, o, AK.p_wbcck, [startx, -p_wbccH]);
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                    faceArr.push(pppps.concat());

                    holes = [];
                    pppps = [new Vector3(p_isstaircmfx > 0 ? W - bkT : 0, -p_wbccH, 0), new Vector3(p_isstaircmfx > 0 ? W - bkT : 0, -p_wbccH, p_wbccW),
                    new Vector3(p_isstaircmfx > 0 ? W - bkT : 0, 0, p_wbccW), new Vector3(p_isstaircmfx > 0 ? W - bkT : 0, 0, 0)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                    faceArr.push(pppps.concat());

                    pppps = [new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : 0, -p_wbccH, p_wbccW - bkT), new Vector3(p_isstaircmfx > 0 ? W : p_wbccL, -p_wbccH, p_wbccW - bkT),
                    new Vector3(p_isstaircmfx > 0 ? W : p_wbccL, 0, p_wbccW - bkT), new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : 0, 0, p_wbccW - bkT)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                    faceArr.push(pppps.concat());
                    holes = [];
                    // if(p_iswbccfb){
                    startz = p_wbccW - BKH;
                    pppps = [new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL - bkT, -p_wbccH, p_wbccW - BKH), new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL - bkT, -p_wbccH, p_wbccW),
                    new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL - bkT, 0, p_wbccW), new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL - bkT, 0, p_wbccW - BKH)];
                    // }else{
                    //     startz = 0;
                    //     pppps = [new Vector3(p_isstaircmfx > 0?W-p_wbccL:p_wbccL-bkT,-p_wbccH,0),new Vector3(p_isstaircmfx > 0?W-p_wbccL:p_wbccL-bkT,-p_wbccH,p_wbccW),
                    //         new Vector3(p_isstaircmfx > 0?W-p_wbccL:p_wbccL-bkT,0,p_wbccW),new Vector3(p_isstaircmfx > 0?W-p_wbccL:p_wbccL-bkT,0,0)];
                    // }
                    MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_wbcck], holes, BKKJMDis, 1, p_wbccH, o, AK.p_wbcck, [startz, -p_wbccH]);
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT, 1);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                    faceArr.push(pppps.concat());

                    pppps = [new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, 0 - bkT, 0), new Vector3(p_isstaircmfx > 0 ? W : 0, 0 - bkT, 0),
                    new Vector3(p_isstaircmfx > 0 ? W : 0, 0 - bkT, p_wbccW), new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL, 0 - bkT, p_wbccW),
                    new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL, 0 - bkT, p_wbccW - BKH), new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, 0 - bkT, p_wbccW - BKH)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, bkT);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                    faceArr.push(pppps.concat());

                    if (p_iswbccfb) {
                        pppps = [new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, -p_wbccH, 0), new Vector3(p_isstaircmfx > 0 ? W : 0, -p_wbccH, 0),
                        new Vector3(p_isstaircmfx > 0 ? W : 0, -p_wbccH, p_wbccW), new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL, -p_wbccH, p_wbccW),
                        new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL, -p_wbccH, p_wbccW - BKH), new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, -p_wbccH, p_wbccW - BKH)];
                    } else {
                        pppps = [new Vector3(p_isstaircmfx > 0 ? W : 0, -p_wbccH, 0), new Vector3(p_isstaircmfx > 0 ? W : 0, -p_wbccH, p_wbccW),
                        new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL, -p_wbccH, p_wbccW), new Vector3(p_isstaircmfx > 0 ? W - p_wbccL : p_wbccL, -p_wbccH, 0)];
                    }
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, bkT);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);
                    faceArr.push(pppps.concat());
                }
            }
        }

        // for(i=0;i<vec.length;i+=9){
        //     if(vec.length > i+8){
        //         faceArr.push([new Vector3(vec[i],vec[i+1],vec[i+2]),
        //         new Vector3(vec[i+3],vec[i+4],vec[i+5]),new Vector3(vec[i+6],vec[i+7],vec[i+8])]);
        //     }
        // }

        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr };
        return [vec,indics,faceArr];
    }

    public getanglebypath(path: Vector3, path2: Vector3): number {
        let dir = path.clone().sub(path2);
        let dir2 = new Vector3(1, 0, 0);
        let anglee = dir2.angleTo(dir.clone().normalize());
        anglee = (Math.PI - anglee);
        if (dir.z != 0) {
            anglee = dir.z > 0 ? anglee : -anglee;
        }
        if (dir.y != 0) {
            anglee = dir.y > 0 ? -anglee : anglee;
        }
        return anglee
    }

    
    public getTXGeometryBy(l: number, w: number, w2: number, h: number): BufferGeometry {
        let newVec2: number[] = [];
        let i: number, boo = false, len = 0, tempObj: any;//getPsLWbyVec3
        let vs = [new Vector3(0, h, 0), new Vector3(0, h, w), new Vector3(0, 0, w2 + (w - w2) / 2)
            , new Vector3(0, 0, (w - w2) / 2)];
        let indics = [];
        tempObj = MeshGeomLib.getFaceHoleNs(vs, [], 3, l);
        indics.push(...tempObj.indics.map((value) => { value += newVec2.length / 3; return value; }));
        newVec2.push(...tempObj.vec);
        let geo = new BufferGeometry();
        geo.setIndex(indics);
        geo.setAttribute('position', new Float32BufferAttribute(newVec2, 3));
        geo.computeVertexNormals();
        return geo;
    }

    /**
     * 多边形生成几何体
     */
    public getGeometryByVecs2(ps: Vector3[], h: number = 0, type: number = 1, extreVec: any = null): BufferGeometry {
        let newVec2: number[] = [];
        let i: number, boo = false, len = 0, tempObj: any;//getPsLWbyVec3

        let indics = [];

        tempObj = MeshGeomLib.getFaceHoleNs(ps, [], type, h);
        indics.push(...tempObj.indics.map((value) => { value += newVec2.length / 3; return value; }));
        newVec2.push(...tempObj.vec);

        if (extreVec) {
            indics.push(...extreVec.indics.map((value) => { value += newVec2.length / 3; return value; }));
            newVec2.push(...extreVec.vec);
        }

        let geo = new BufferGeometry();
        geo.setIndex(indics);
        geo.setAttribute('position', new Float32BufferAttribute(newVec2, 3));
        geo.computeVertexNormals();
        return geo;
    }

    

    /**
     * 顶点生成几何体
     */
    public getGeometryByVertices(ps: Vector3[]): BufferGeometry {
        if (ps.length < 3) {
            return null;
        }

        let vertices = [];
        let i: number, j: number;
        vertices = [
            ps[1].x, ps[1].y, ps[1].z,
            ps[0].x, ps[0].y, ps[0].z,
            ps[2].x, ps[2].y, ps[2].z,

            ps[0].x, ps[0].y, ps[0].z,
            ps[3].x, ps[3].y, ps[3].z,
            ps[2].x, ps[2].y, ps[2].z,

            ps[5].x, ps[5].y, ps[5].z,
            ps[4].x, ps[4].y, ps[4].z,
            ps[6].x, ps[6].y, ps[6].z,

            ps[4].x, ps[4].y, ps[4].z,
            ps[7].x, ps[7].y, ps[7].z,
            ps[6].x, ps[6].y, ps[6].z,

            ps[1].x, ps[1].y, ps[1].z,
            ps[5].x, ps[5].y, ps[5].z,
            ps[2].x, ps[2].y, ps[2].z,

            ps[5].x, ps[5].y, ps[5].z,
            ps[6].x, ps[6].y, ps[6].z,
            ps[2].x, ps[2].y, ps[2].z,

            ps[0].x, ps[0].y, ps[0].z,
            ps[4].x, ps[4].y, ps[4].z,
            ps[3].x, ps[3].y, ps[3].z,

            ps[4].x, ps[4].y, ps[4].z,
            ps[7].x, ps[7].y, ps[7].z,
            ps[3].x, ps[3].y, ps[3].z,

            ps[1].x, ps[1].y, ps[1].z,
            ps[5].x, ps[5].y, ps[5].z,
            ps[0].x, ps[0].y, ps[0].z,

            ps[5].x, ps[5].y, ps[5].z,
            ps[4].x, ps[4].y, ps[4].z,
            ps[0].x, ps[0].y, ps[0].z,

            ps[2].x, ps[2].y, ps[2].z,
            ps[6].x, ps[6].y, ps[6].z,
            ps[3].x, ps[3].y, ps[3].z,

            ps[6].x, ps[6].y, ps[6].z,
            ps[7].x, ps[7].y, ps[7].z,
            ps[3].x, ps[3].y, ps[3].z,
        ];
        let tempvertices = new Float32Array(vertices);
        let arrowGeometry = new BufferGeometry();
        let gggg = new BoxGeometry(10, 10, 10);
        arrowGeometry.setAttribute('position', new BufferAttribute(tempvertices, 3));
        arrowGeometry.computeVertexNormals();
        return arrowGeometry;
    }

    

    public getBuffGeometry(vs: number[]): BufferGeometry {
        let tempvertices = new Float32Array(vs);
        let arrowGeometry = new BufferGeometry();
        arrowGeometry.setAttribute('position', new BufferAttribute(tempvertices, 3));
        arrowGeometry.computeVertexNormals();
        return arrowGeometry;
    }


     /**
     * 生成楼梯一体化狗牙 一体狗牙
     */
     public getStairintegrationDog(o: any){
        let i: number, j: number, boo: boolean = false, tempObj: any, expressarr: any, pppps: Vector3[], pppps2: Vector3[];
        let L: number = Number(o.L), W: number = Number(o.W), H: number = Number(o.H), GMT: number = o.GMT;
        let BKH: number = Number(o[AK.BKH]), bkT: number = o[AK.bkT], BKDia: number = Number(o[AK.BKDia]), LL: number = o[AK.LL];
        let BKKJMDis: number = Number(o[AK.BKKJMDis]), p_isqL: number = o[AK.p_isqL], p_qktype: number = o[AK.p_qktype];
        let p_pkl: number = Number(o[AK.p_pkl]), p_pkw: number = Number(o[AK.p_pkw]), pbW: number = Number(o[AK.pbW]);
        let p_isstaircmfx: number = Number(o[AK.p_isstaircmfx]) - 1, p_isqdpbpq: number = Number(o[AK.p_iswbpbpq]) == 0 ? 1 : 0;
        let p_iswbpbpq: number = Number(o[AK.p_isqdpbpq]) == 0 ? 1 : 0, p_iswbcc: number = Number(o[AK.p_iswbcc]) == 0 ? 1 : 0, p_iswbccfb: number = Number(o[AK.p_iswbccfb]) == 0 ? 1 : 0;
        let p_wbccW: number = Number(o[AK.p_wbccW]), p_wbccL: number = Number(o[AK.p_wbccL]), p_wbccH: number = Number(o[AK.p_wbccH]), p_stairendH: number = Number(o[AK.p_stairendH]);
        let gyfb1: number = Number(o[AK.gyfb1]);
        let vec = [];
        let indics = [];
        let holes = [];
        let vertices = [];
        let pkLen = p_qktype > 0 ? p_pkl : 0;
        let stairw: number = W, stairh: number = Number(o[AK.p_stairH]), stairl: number = Number(o[AK.p_stairW]), stairnum: number = Number(o[AK.TBS]);
        let angle: number = Math.atan2(stairh, stairl);
        // p_iswbpbpq = 0;

        let angle2: number = angle;//Math.asin(BKH / 200);
        let anglenum3: number = 0//BKH/Math.sin(Math.PI / 2 - angle);//(200 / Math.sin(Math.PI / 2 - angle)) - stairh;
        let anglenum4 = 0//BKH;//anglenum3 / Math.tan(angle);
        let anglenum5 = W / Math.sin(angle);
        //算第一节尖角得长

        let anglenum: number = (stairh + BKH) / Math.tan(angle) - stairl + BKH;//(anglenum3 + stairh) / Math.tan(angle) - stairl;
        let xb = pbW / Math.sin(angle);//斜边
        let tc = xb - (stairl + (p_iswbpbpq ? anglenum : 0));//头长
        let tg = Math.tan(angle) * tc;//头高
        // if(p_iswbpbpq == 0){
        //     anglenum = xb - stairl;
        // }

        let anglenum2: number = anglenum;
        let holenum: number = BKKJMDis + BKDia / 2;
        let nummmm: number = 0, tempH: number = 0, tempL: number = 0, nummmm2: number = 0;
        let nummmm3: number = bkT * Math.tan(angle), nummmm4: number = 0, nummmm5: number = 0, nummmm6: number = 0;
        let nummmm7: number = W / Math.sin(Math.PI / 2 - angle);
        let nummmm8: number = 0;
        let vv: Vector3;
        let faceArr: any = [];
        let gmtkong: Vector3[] = [];
        let pdss: Vector2[] = [];
        let mbpoints: any[] = [];
        let ceps = [];//侧面点组
        // 边框孔中心点
        o.kongpoint = [];
        o.faces = [];
        o['p_stairadd'] = anglenum;
        o['tw'] = anglenum;
        o['tl'] = p_iswbpbpq ? stairl + anglenum : stairl;
        o['th'] = tg;
        let aaabbb;
        let typee: number = 0, startx: number = 0, endx: number = 0, starty: number = 0, startz: number = 0;
        o.duan = [];

        let ispbpqnum = 0//p_iswbpbpq?0:tc;
        let holes2 = [];
        if (o[AK.p_r1dw] && o[AK.p_r1dw] != '' && o[AK.p_r1dw].indexOf('(') > -1 && o[AK.p_r1dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r1], o[AK.p_r1dw], holes2, 1, false, 0, p_iswbpbpq ? 0 : anglenum, gmtkong);
        }
        if (o[AK.p_r2dw] && o[AK.p_r2dw] != '' && o[AK.p_r2dw].indexOf('(') > -1 && o[AK.p_r2dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r2], o[AK.p_r2dw], holes2, 1, false, 0, p_iswbpbpq ? 0 : anglenum, gmtkong);
        }
        if (o[AK.p_r3dw] && o[AK.p_r3dw] != '' && o[AK.p_r3dw].indexOf('(') > -1 && o[AK.p_r3dw].indexOf(')') > -1) {
            MoldUtils.getGmtHoles(o[AK.p_r3], o[AK.p_r3dw], holes2, 1, false, 0, p_iswbpbpq ? 0 : anglenum, gmtkong);
        }
        let holes2Vec2: Vector2[] = [];
        holes2.map((hv) => {
            holes2Vec2.push(new Vector2(hv.currentPoint.x, hv.currentPoint.y));
        })
        ceps.push(new Vector3(0, 0, (p_iswbpbpq === 0 ? anglenum : 0)));
        for (i = 0; i < stairnum; i++) {
            tempH = i * stairh;
            tempL = i === 0 ? i * stairl : i * stairl + (p_iswbpbpq === 0 ? 0 : anglenum);
            if (p_iswbpbpq === 0) {
                tempL += anglenum;
            }
            //最后一阶增高变化的长
            if (p_stairendH > stairh && i === stairnum - 1 && !p_isqdpbpq) {
                nummmm4 = (anglenum + stairl) * Math.tan(angle);
                if (p_stairendH > nummmm4) {
                    p_stairendH = nummmm4;
                }
                nummmm4 = (p_stairendH - stairh);
                nummmm5 = p_stairendH / Math.tan(angle) - (stairh / Math.tan(angle));
            }
            // if (p_stairendH > stairh && i === stairnum - 1 && !p_isqdpbpq) {
            //     nummmm5 = p_stairendH / Math.tan(angle) - (stairh / Math.tan(angle));
            // }

            ceps.push(new Vector3(0, stairh * i, stairl * (i + 1) + (p_iswbpbpq > 0 ? anglenum : anglenum)), new Vector3(0, stairh * (i + 1) + nummmm4, stairl * (i + 1) + (p_iswbpbpq > 0 ? anglenum : anglenum)));

            nummmm = i === 0 ? (p_iswbpbpq === 0 ? 0 : anglenum) : 0;
            nummmm6 = i === 0 ? 0 : 0;
            startx = p_isstaircmfx > 0 ? 0 : W - bkT;
            if (i === stairnum - 1 && !p_isqdpbpq) {
                pppps = [new Vector3(startx, tempH, tempL - BKH - ispbpqnum), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm - ispbpqnum), new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL + nummmm - ispbpqnum),
                new Vector3(startx, stairh + tempH + nummmm4, stairl - BKH + tempL + nummmm - ispbpqnum), new Vector3(startx, BKH + tempH, stairl - BKH + tempL + nummmm - ispbpqnum), new Vector3(startx, BKH + tempH, nummmm + tempL - BKH - ispbpqnum)];
            } else {
                if (!p_iswbpbpq && i === 0) {
                    pppps = [new Vector3(startx, tempH, tempL), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm - ispbpqnum), new Vector3(startx, stairh + tempH, stairl + tempL + nummmm - ispbpqnum),
                    new Vector3(startx, stairh + tempH, stairl - BKH + tempL + nummmm - ispbpqnum), new Vector3(startx, BKH + tempH, stairl - BKH + tempL + nummmm - ispbpqnum), new Vector3(startx, BKH + tempH, tempL)];
                } else {
                    pppps = [new Vector3(startx, tempH, tempL - (i == 0 ? 0 : BKH) - ispbpqnum), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm - ispbpqnum), new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL + nummmm - ispbpqnum),
                    new Vector3(startx, stairh + tempH + nummmm4, stairl - BKH + tempL + nummmm - ispbpqnum), new Vector3(startx, BKH + tempH, stairl - BKH + tempL + nummmm - ispbpqnum), new Vector3(startx, BKH + tempH, nummmm + tempL - nummmm6 - (i == 0 ? BKH : BKH) - ispbpqnum)];
                }
            }

            //平孔 竖孔
            holes = [], gmtkong = [];
            MeshGeomLib.getHoles((BKDia).toString(), o['C' + AK.Lpk], holes, BKH - BKKJMDis, 0, stairl, o, 'C' + AK.Lpk, [tempL + nummmm - ispbpqnum, tempH], false, gmtkong);
            MeshGeomLib.getHoles((BKDia).toString(), o['C' + AK.Lsk], holes, BKKJMDis, 1, stairh, o, 'C' + AK.Lsk, [tempL + (stairl + nummmm - BKH) - ispbpqnum, tempH], false, gmtkong);

            tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT, 1, p_isstaircmfx ? 1 : 0, gmtkong, o.kongpoint, faceArr, 'C' + AK.Lsk);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);


            //底
            holes = [];
            pppps = [new Vector3(0, tempH, (p_iswbpbpq > 0 ? tempL - (i == 0 ? 0 : BKH) : tempL - (i == 0 ? 0 : BKH))), new Vector3(0 + W, tempH, (p_iswbpbpq > 0 ? tempL - (i == 0 ? 0 : BKH) : tempL - (i == 0 ? 0 : BKH))),
            new Vector3(0 + W, tempH, stairl + tempL + nummmm), new Vector3(0, tempH, tempL + stairl + nummmm)];

            tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, bkT, 0, 1, [], null, faceArr);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);


            nummmm2 = i === stairnum - 1 && !p_isqdpbpq ? 0 : anglenum3;
            pppps = [new Vector3(0, 0 + tempH, stairl + tempL + nummmm - bkT - ispbpqnum), new Vector3(W, 0 + tempH, stairl + tempL + nummmm - bkT - ispbpqnum), new Vector3(W, stairh + tempH + nummmm4, stairl + tempL + nummmm - bkT - ispbpqnum)
                , new Vector3(0, stairh + tempH + nummmm4, stairl + tempL + nummmm - bkT - ispbpqnum)];
            tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT, 0, 0, [], null, faceArr);
            indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
            vec.push(...tempObj.vec);


            tempL = i * stairl;
            nummmm = i === 0 ? anglenum : anglenum;
            startx = p_isstaircmfx > 0 ? W - bkT : 0;
            if (p_isqdpbpq > 0 && i === stairnum - 1) {
                pppps = [new Vector3(startx, tempH, tempL - ispbpqnum), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm - ispbpqnum), new Vector3(startx, stairh + tempH + anglenum3 + nummmm4, stairl + tempL + nummmm - ispbpqnum),
                new Vector3(startx, stairh + tempH + (anglenum3 - anglenum2) + nummmm4, stairl - BKH + tempL + nummmm - ispbpqnum)];
            } else {
                if (!p_iswbpbpq && i === 0) {
                    pppps = [new Vector3(startx, tempH, tempL + nummmm - ispbpqnum), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm - ispbpqnum),
                    new Vector3(startx, stairh + tempH, stairl + tempL + nummmm - ispbpqnum), new Vector3(startx, stairh + tempH, stairl + nummmm - ispbpqnum)
                        , new Vector3(startx, anglenum3, tempL + nummmm - ispbpqnum)];//
                } else {
                    if (!p_iswbpbpq) {
                        pppps = [new Vector3(startx, tempH, (tempL < nummmm ? nummmm : tempL) - ispbpqnum), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm - ispbpqnum),
                        new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL + nummmm - ispbpqnum), new Vector3(startx, stairh + tempH + nummmm4, (tempL < nummmm ? nummmm : stairl + tempL + nummmm5) - ispbpqnum)];//
                    } else {
                        pppps = [new Vector3(startx, tempH, tempL - ispbpqnum), new Vector3(startx, 0 + tempH, stairl + tempL + nummmm - ispbpqnum),
                        new Vector3(startx, stairh + tempH + nummmm4, stairl + tempL + nummmm - ispbpqnum), new Vector3(startx, stairh + tempH + nummmm4, (i === 0 ? stairl : stairl + tempL + nummmm5) - ispbpqnum)];//
                    }
                }
            }
            vertices = [];
            pppps.map((vvv) => {
                vertices.push([vvv.y, vvv.z]);
            })
            mbpoints.push(vertices);

            if (i === stairnum - 1) {
                nummmm = 0//p_iswbpbpq === 0 ? anglenum3 : 0;//高
                nummmm2 = p_iswbpbpq === 0 ? anglenum : 0;//anglenum : 0;//长
                //下
                holes = [], gmtkong = [];
                startx = p_isstaircmfx > 0 ? W - BKH : 0;
                endx = p_isstaircmfx > 0 ? W : BKH;
                MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dipbfbk], holes, p_isstaircmfx > 0 ? BKKJMDis : BKH - BKKJMDis, 1, tg, o, AK.p_dipbfbk, [startx, 0], false, gmtkong);
                pppps = [new Vector3(startx, 0, nummmm2 - ispbpqnum), new Vector3(startx, 0 + tg, nummmm2 - ispbpqnum),
                new Vector3(endx, 0 + tg, nummmm2 - ispbpqnum), new Vector3(endx, 0, nummmm2 - ispbpqnum)];

                tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, gyfb1 ? gyfb1 : bkT, 0, 1, gmtkong, o.kongpoint, faceArr, AK.p_dipbfbk);
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                starty = stairh + tempH - tg;
                startz = p_iswbpbpq > 0 ? stairl + tempL + anglenum : stairl + tempL;
                let sxc = p_isqdpbpq > 0 ? (startz) / Math.cos(angle) : (starty) / Math.sin(angle);
                starty = Math.sin(angle) * sxc + tg + nummmm4;
                startz = Math.cos(angle) * sxc + nummmm5;

                ceps.push(new Vector3(0, starty, startz + nummmm2), new Vector3(0, tg, (p_iswbpbpq === 0 ? anglenum : 0)));
                //顶
                holes = [], gmtkong = [];
                if (p_isqdpbpq) {
                    MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dingpbfbk], holes, p_isstaircmfx > 0 ? BKKJMDis : BKH - BKKJMDis, 1, starty - (stairh + tempH), o, AK.p_dingpbfbk, [startx, stairh + tempH]);
                    pppps = [new Vector3(endx, stairh + tempH, startz + nummmm2 - bkT - ispbpqnum), new Vector3(startx, stairh + tempH, startz + nummmm2 - bkT - ispbpqnum),
                    new Vector3(startx, starty, startz + nummmm2 - bkT - ispbpqnum), new Vector3(endx, starty, startz + nummmm2 - bkT - ispbpqnum)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT, 0, 0, gmtkong, o.kongpoint, faceArr, AK.p_dingpbfbk);
                } else {
                    MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dingpbfbk], holes, p_isstaircmfx > 0 ? BKKJMDis : BKH - BKKJMDis, 1, (stairl + tempL + anglenum) - (startz + nummmm2), o, AK.p_dingpbfbk, [startx, startz + nummmm2]);
                    pppps = [new Vector3(endx, starty - bkT, startz + nummmm2), new Vector3(startx, starty - bkT, startz + nummmm2),
                    new Vector3(startx, starty - bkT, stairl + tempL + anglenum), new Vector3(endx, starty - bkT, stairl + tempL + anglenum)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, gyfb1 ? gyfb1 : bkT, 0, 0, gmtkong, o.kongpoint, faceArr, AK.p_dingpbfbk);
                }
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);

                holes = [];


                let isadddd;
                nummmm6 = (starty) / Math.tan(angle);
                pppps = [new Vector3(startx, nummmm, nummmm2), new Vector3(startx + BKH, nummmm, nummmm2), new Vector3(startx + BKH, starty, startz - bkT), new Vector3(startx, starty, startz - bkT)];//new Vector3(startx, starty, nummmm6)
                // tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, bkT,0,1,[],o.kongpoint,faceArr, AK.p_dingpbfbk);
                // indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                // vec.push(...tempObj.vec);
                aaabbb = [new Vector3(startx, nummmm + bkT, nummmm2), new Vector3(startx, starty, startz)];
                // console.log('gyL__'+MeshGeomLib.getInt((new Vector3(startx, starty, startz - bkT).sub(new Vector3(startx, nummmm + bkT, nummmm2))).length(),2));
                // console.log('gyL2__'+MeshGeomLib.getInt((new Vector3(startx, starty, startz).sub(new Vector3(startx, nummmm + bkT, nummmm2))).length(),2));
                // o[AK.gyL] =  MeshGeomLib.getInt((new Vector3(startx, starty, startz - bkT).sub(new Vector3(startx, nummmm + bkT, nummmm2))).length(),2);
                // if(p_isqdpbpq){
                //     let vv7 = MeshGeomLib.VectorProjection3(new Vector3(startx, starty+nummmm7, startz),new Vector3(startx, starty, startz),new Vector3(startx, nummmm + bkT, nummmm2))
                //     o[AK.gyL] =  MeshGeomLib.getInt((vv7.sub(new Vector3(startx, nummmm + bkT, nummmm2))).length(),2);
                // }else{
                //     o[AK.gyL] =  MeshGeomLib.getInt((new Vector3(startx, starty, startz).sub(new Vector3(startx, nummmm + bkT, nummmm2))).length(),2);
                // }
                let wbnum = p_isqdpbpq > 0 ? nummmm7 : 0;
                let sl = Math.sin(angle) * tg;
                let sl2 = tc / Math.cos(angle);
                let sl3;
                if (p_isqdpbpq) {
                    sl3 = (tc + stairl + tempL) / Math.cos(angle);
                    o[AK.gyL] = sl3 - sl2 + sl;
                } else {
                    let sl4 = (stairl + tempL + anglenum) - (startz + nummmm2);
                    sl4 = Math.cos(angle) * sl4;
                    sl3 = starty / Math.sin(angle);
                    o[AK.gyL] = sl3 - sl2 + sl + sl4;
                }
                console.log('gyL__' + o[AK.gyL]);

                o[AK.L] = starty - (nummmm + bkT);
                o[AK.H] = startz - (nummmm2);
                o[AK.gyW] = pbW;

                pppps = [new Vector3(startx, nummmm, nummmm2 - ispbpqnum), new Vector3(startx, nummmm, nummmm2 + bkT - ispbpqnum),
                new Vector3(startx, starty - bkT, startz - ispbpqnum), new Vector3(startx, starty, startz - ispbpqnum)];//new Vector3(startx, starty, nummmm6)
                vertices = [];
                pppps.map((vvv) => {
                    vertices.push([vvv.y, vvv.z]);
                })
                mbpoints.push(vertices);

                //下
                // nummmm6 = (starty) / Math.tan(angle);
                // pppps = [new Vector3(startx, nummmm, nummmm2), new Vector3(startx, nummmm + bkT, nummmm2), new Vector3(startx, starty, startz - bkT), new Vector3(startx, starty, nummmm6)];
                // tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, BKH,0,1,[],null,faceArr);
                // indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                // vec.push(...tempObj.vec);
                // o[AK.gyL] =  MeshGeomLib.getInt((new Vector3(startx, starty, startz - bkT).sub(new Vector3(startx, nummmm + bkT, nummmm2))).length(),2);
                // o[AK.gyW] = 200 + pbW;

                // o[AK.gyL].push(startx, nummmm, nummmm2,startx, nummmm + bkT, nummmm2,startx, starty, startz - bkT,startx, starty, nummmm6);
                //上
                // starty = stairh + tempH - tg;
                // startz = p_iswbpbpq > 0 ? stairl + tempL + anglenum : stairl + tempL;
                // let sxc = p_isqdpbpq > 0?(startz)/Math.cos(angle):(starty)/Math.sin(angle);
                // starty = Math.sin(angle) * sxc + tg;
                // startz = Math.cos(angle) * sxc;
                nummmm3 = sxc;
                expressarr = AModelFmulaUtils.getHolesbyExpress(o[AK.p_skkw], nummmm3, 2, o, AK.p_skkw);
                //从0点开始拉
                expressarr.map((value) => {
                    if ((value) < nummmm3) {
                        if (p_iswbpbpq) {
                            holes.push({ radius: BKDia / 2, x: p_isstaircmfx > 0 ? BKKJMDis : BKH - BKKJMDis, y: nummmm2 + value, h: tg, l: startx, z: ispbpqnum })
                        } else {
                            holes.push({ radius: BKDia / 2, x: p_isstaircmfx > 0 ? BKKJMDis : BKH - BKKJMDis, y: value, h: tg, l: startx, z: -anglenum })//anglenum3
                        }
                    }
                });
                pppps = [new Vector3(startx, nummmm + tg - bkT, nummmm2 - ispbpqnum), new Vector3(endx, nummmm + tg - bkT, nummmm2 - ispbpqnum), new Vector3(endx, starty - bkT, startz - ispbpqnum + nummmm2), new Vector3(startx, starty - bkT, startz - ispbpqnum + nummmm2)];
                pppps2 = [new Vector3(startx, nummmm + tg, nummmm2 - ispbpqnum), new Vector3(endx, nummmm + tg, nummmm2 - ispbpqnum), new Vector3(endx, starty, startz - ispbpqnum + nummmm2), new Vector3(startx, starty, startz - ispbpqnum + nummmm2)];
                vv = pppps2[2].clone().sub(pppps2[1]);
                angle2 = Math.atan2(vv.y, vv.z);
                tempObj = MeshGeomLib.getFaceHoleNs3(pppps2, pppps, holes, 1, angle2 * 180 / Math.PI, i > 0 ? new Vector3(-1, -1, 1) : new Vector3(1, 1, 1));
                indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                vec.push(...tempObj.vec);


                // tempObj = MeshGeomLib.getFaceHoleNs2(pppps,holes,1,bkT);
                // indics.push(...tempObj.indics.map((value) => {value += vec.length/3;return value;}));
                // vec.push(...tempObj.vec);

                holes = [];
                //侧
                // startx = p_isstaircmfx > 0 ? W - bkT : 0;
                // if (p_isqdpbpq > 0) {
                //     pppps = [new Vector3(startx, nummmm+tg, nummmm2-ispbpqnum), new Vector3(startx, starty - tg, startz-ispbpqnum),
                //     new Vector3(startx, starty, startz-ispbpqnum), new Vector3(startx, nummmm + tg, nummmm2-ispbpqnum)];
                // } else {
                //     pppps = [new Vector3(startx, nummmm + 0, nummmm2-ispbpqnum), new Vector3(startx, starty, startz+tg),
                //     new Vector3(startx, starty, startz), new Vector3(startx, nummmm + tg, 0)];
                // }
                // tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT);
                // indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                // vec.push(...tempObj.vec);

                // vertices = [];
                // pppps.map((vvv)=>{
                //     vertices.push([vvv.y,vvv.z]);
                // })
                // mbpoints.push(vertices);


                // MeshGeomLib.getHoles((BKDia).toString(), o[AK.p_dingpbfbk], holes,BKH/2,1,anglenum4,o,AK.p_dingpbfbk,[W-BKH,stairl+tempL]);
                let addnum: number = BIM.simpleMold ? bkT : bkT;
                //最后那节封顶
                if (!p_isqdpbpq) {
                    if (p_isstaircmfx > 0) {
                        pppps = [
                            new Vector3(0, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum)),
                            new Vector3(0, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum) - BKH),
                            new Vector3(W - BKH, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum) - BKH),
                            new Vector3(W - BKH, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum))];
                        // o.duan.push(W, starty - bkT + nummmm4+addnum, stairl + tempL + anglenum4,0, stairh + tempH - bkT + nummmm4 + addnum, stairl + tempL + anglenum4);
                    } else {
                        pppps = [
                            new Vector3(W, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum)),
                            new Vector3(W, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum) - BKH),
                            new Vector3(BKH, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum) - BKH),
                            new Vector3(BKH, starty - bkT, stairl + tempL + (p_iswbpbpq > 0 ? anglenum : anglenum))];
                        // o.duan.push(0, stairh + tempH - bkT + nummmm4+addnum, stairl + tempL + anglenum4,W, stairh + tempH - bkT + nummmm4 + addnum, stairl + tempL + anglenum4);
                    }
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 1, gyfb1 ? gyfb1 : bkT, 0, 0);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                }

                if (!p_iswbpbpq) {
                    pppps = [new Vector3(p_isstaircmfx > 0 ? W : 0, 0, nummmm2 - ispbpqnum), new Vector3(p_isstaircmfx > 0 ? W : 0, nummmm, nummmm2 - ispbpqnum),
                    new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, nummmm, nummmm2 - ispbpqnum), new Vector3(p_isstaircmfx > 0 ? W - BKH : BKH, BKH, nummmm2 - ispbpqnum),
                    new Vector3(p_isstaircmfx > 0 ? 0 : W, BKH, nummmm2 - ispbpqnum), new Vector3(p_isstaircmfx > 0 ? 0 : W, 0, nummmm2 - ispbpqnum)];
                    tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 2, gyfb1 ? gyfb1 : bkT, 0, 1);
                    indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
                    vec.push(...tempObj.vec);

                }
            }
        }
        o.duan.push(startx, tg, nummmm2, endx, tg, nummmm2, endx, starty, nummmm2 + startz, startx, starty, nummmm2 + startz);
        if (!p_isqdpbpq) {
            o.duan.push(0, starty, stairl + tempL + (p_iswbpbpq ? anglenum : anglenum), W, starty, stairl + tempL + (p_iswbpbpq ? anglenum : anglenum));
        }
        // 侧  面板  打面板孔
        startx = p_isstaircmfx > 0 ? W - bkT : 0;
        // let mbs = MeshGeomLib.getUnits(mbpoints);
        // if(mbs.length > 0) mbs.pop();
        pppps = [], holes = [];
        ceps.map((mb) => {
            pppps.push(new Vector3(startx, mb.y, mb.z));
        })
        // pppps = ceps;
        o['mbps'] = pppps;
        //清除不在面得面板孔
        if (holes2Vec2.length > 0) {
            pdss = [];
            pppps.map((pds) => {
                pdss.push(new Vector2(pds.y, pds.z));
            })
            for (j = 0; j < holes2Vec2.length; j++) {
                if (MeshGeomLib.IsPointInPolygon(holes2Vec2[j], pdss)) {
                    holes.push(holes2[j]);
                }
            }
        }
        tempObj = MeshGeomLib.getFaceHoleNs2(pppps, holes, 3, bkT, 0, p_isstaircmfx ? 0 : 1, gmtkong, o.kongpoint, faceArr, AK.p_r1dw);
        indics.push(...tempObj.indics.map((value) => { value += vec.length / 3; return value; }));
        vec.push(...tempObj.vec);

        // let geo = new BufferGeometry();
        // geo.setIndex(indics);
        // geo.setAttribute('position', new Float32BufferAttribute(vec, 3));

        // geo.computeVertexNormals();
        // geo.userData = { farr: faceArr, ab: aaabbb };
        // return geo;
        return [vec,indics,faceArr];

    }

    

}